Select to view content in your preferred language

Definition Queries on AGOL REST endpoint - query on time feature created

1148
4
11-13-2018 06:56 PM
AnthonyCheesman1
Frequent Contributor

Hello

I'm currently consuming a REST endpoint from ArcGIS Online in ArcMap. I would like to be able to apply a definition query to the layer to select records that are only (for example) less than 24 hours old. Editor tracking is enabled on the feature service, so I have automatically populated fields for 'CreationDate' and 'EditDate'. These times are recorded in UTC.

I cannot work out the SQL syntax to make this occur - in particular how to access 'current time' (which in my circumstance will need to be current time in UTC).

Is anyone able to assist with this?

0 Kudos
4 Replies
shan_sarkar
Frequent Contributor

Anthony,

Have you tried Dynamic Date Filter 

I hope this helps!

~Shan


~Shan
AnthonyCheesman1
Frequent Contributor

Hello Shan, thanks for the reply.

I was hoping to be able to consume my REST endpoint in ArcMap and filter on time in a couple of different ways. The issue I'm facing is that AGOL publishes all times in UTC whereas ArcMap uses PC time (and I can't find a way of generating UTC time in SQL).

Your suggestion however did start pointing me in the right direction, and I've worked out that I can't easily do what it is I was wanting to do. So my solution has been to generate view layers at the AGOL end with the appropriate definitions, and then I'll consume these in ArcMap without have to apply any definition queries.

Thanks for the inspiration!

Anthony

0 Kudos
shan_sarkar
Frequent Contributor

Anthony,

I believe arcmap has an option to select the editor time in UTC.

So, if you can select the time in UTC format and any updates from that point onwards will be UTC time.

I hope this helps!

~Shan


~Shan
0 Kudos
AndrewHargreaves2
Deactivated User

Is it possible to use the select layer by attribute‌ to select records created today? I'm trying 

CreationDate = timestamp NOW()

But getting an error.

0 Kudos