Select to view content in your preferred language

Filter Most Recent Records by Time (mins) in Dynamic Data

4646
12
02-25-2019 03:07 PM
by Anonymous User
Not applicable

Has anyone needed to get the most current record by filtering on day/time of a dynamic data set (it is currently a hosted feature service in AGO)?  The data is refreshed about every 10 mins. I am trying to use filtering or Arcade expressions.  Thank you.  Jake Skinner

0 Kudos
12 Replies
KhaledHassen
Esri Contributor

Hi Andrew,

I see you are passing the filter above in the url without any url encoding. This will not work.

The topFilter in the url will look like:

&topFilter=%7B"groupByFields"%3A+"Editor"%2C+"topCount"%3A+1%2C+"orderByFields"%3A+"EditDate"%7D+

Pl. note I used double quote for the group by and order by fields.

Thanks

Khaled

0 Kudos
AndrewHargreaves1
Occasional Contributor

Do I encode the whole URL or only the query portion of REST URL, as below:

https://xxxxxxx/arcgis/rest/services/xxx/xxxxx/FeatureServer/101/%3Fwhere%3D%26objectIds%3D%26time%3D%26topFilter%3D%7B%22groupByFields%22%3A+%E2%80%9Cassetkey%E2%80%9D%2C+%22topCount%22%3A+1%2C+%22orderByFields%22%3A+%E2%80%9Cworkdate%E2%80%9D%7D%26geometry%3D%26geometryType%3DesriGeometryEnvelope%26inSR%3D%26spatialRel%3DesriSpatialRelIntersects%26distance%3D%26units%3DesriSRUnit_Foot%26outFields%3D%2A%26returnGeometry%3Dtrue%26maxAllowableOffset%3D%26geometryPrecision%3D%26outSR%3D%26returnIdsOnly%3Dfalse%26returnCountOnly%3Dfalse%26returnExtentOnly%3Dfalse%26returnZ%3Dfalse%26returnM%3Dfalse%26resultType%3D%26f%3Dpjson%0D%0A%0D%0A

Either way, i'm not getting any results back when i drop this into my browser. What am I doing wrong here?

Thanks

0 Kudos
JayJohnsonWashoeCounty
Frequent Contributor

Khaled, Can you take a look at this related question?

https://community.esri.com/message/920629-update-hosted-layer-view-definition-w-topfilter-to-show-on... 

Thanks.

Jay

Jay
Washoe County GIS
0 Kudos