Querying a feature layer based on date?

323
3
04-28-2023 07:10 AM
bsklaohfl
New Contributor III

Using Survey123 Connect, is it possible to query a feature layer based on a dateTime field? I've been trying this, but have not had any luck.

3 Replies
IsmaelChivite
Esri Notable Contributor

Below is an example: Configures the Inbox to retrieve only records where the date value in the install_date column is now older than a week from the current date.

IsmaelChivite_0-1682701645618.png

 

0 Kudos
bsklaohfl
New Contributor III

Thank you for responding. Can this feature be used for a pulldata getRecord calculation?

0 Kudos
IsmaelChivite
Esri Notable Contributor

I realize now that you seemed to be asking a different question originally. Sorry for the guessing.

To your question: Yes, the pulldata getRecord operation allows you to query date fields. Essentially, any WHERE statement you can pass to a feature layer, is supported in the pulldata getRecord operation.

For example:

  • pulldata("@layer","getRecord","<yourlayerURL>","RECDATETIME BETWEEN CURRENT_TIMESTAMP - 7 AND CURRENT_TIMESTAMP")
  • pulldata("@layer","getRecord","<yourlayerURL>","RECDATETIME BETWEEN DATE '2023-04-27' AND DATE '2023-04-29'")

 

Check the Date and Time format section of this help topic for details on the date queries you can make to an ArcGIS layer: https://developers.arcgis.com/rest/services-reference/enterprise/query-feature-service-layer-.htm 

Important consideration:

  • ArcGIS stores date values in UTC.
  • The pulldata() get record operation returns only ONE record. 

 

0 Kudos