With Problem Smart Group Using a 'Date' Result from Extension Attribute

mschroder
Valued Contributor

Dear experts,

I am struggling with a smart computer group that is using a 'date' type result from an Extension Attribute. The EA is returning the date as 'YYYY-MM-DD hh:mm:ss', and I see the values in the JSS and in the mysql table. But I when I try to use any of the date type operators I always end up with an empty group. Any idea what might be wrong?

4 REPLIES 4

patgmac
Contributor III

Can we see an example of your output to make sure it's formatted correctly?

mschroder
Valued Contributor

Hi,

thanks for your interest. Let's start with the EA, the relevant part is

...
if [ $isLocalIP -eq 1 ]; then date=$( date "+%Y-%m-%d %H:%M:%S" ) echo "<result>$date</result>"
fi

exit 0
...

On the JSS it looks like this: "LastTimeOnSite: 2017-03-24 11:31:21"

The DB gives me:
...
mysql> select report_id, value_on_client from extension_attribute_values where extension_attribute_id = 8;
--------------------------------
| report_id | value_on_client |
--------------------------------
| -1 | |
| 1780 | |
| 1805 | 2017-03-24 11:08:07 |
| 1809 | 2017-03-24 11:31:21 |
| 1808 | 2017-03-24 11:30:26 |
| 1806 | 2017-03-24 11:20:27 |
| 1804 | 2017-03-24 10:51:22 |
| 1807 | 2017-03-24 10:51:22 |
| 1781 | |
--------------------------------+
9 rows in set (0.00 sec)

mysql> ...

I assume it it something rather simple, but I don't spot it.

mm2270
Legendary Contributor III

Hmm. Nothing looks wrong about your EA to me at first glance. The EA is saved as a Date Extension Attribute I assume, or else you wouldn't even be able to try creating a Smart Group based on a date value.
Can you give us an example of an advanced search or Smart Group criteria you're using that isn't populating anything?

mschroder
Valued Contributor

Tes, the EA is saved with a Data Type of Date.

The smart group is very simple, there is just one single criterion: "LastTimeOnSite after 2017-01-01":
174587acc39049fd9f75bd755768bc8a

I also tried
- 'before' that date,
- before 2018-01-01
- less than x days ago, with x being 1 or 0
- more than x day ago, with x being 1 or 0

For all of these the smart group shows zero members.