Select to view content in your preferred language

Get the most recent date with a pulldata

1135
2
07-06-2023 09:52 AM
Polesig
Regular Contributor
I want to set up a form that allows to control the vegetation on plots. A plot can be checked several times during the year.
When collecting a new survey I would like to retrieve the date of the last control carried out on the plot with a pulldata on the feature layer of the form itself, like this: pulldata("@layer","getValueAt","attributes.date_collecte",${feature_layer_id_parcelle},${Location}) My questions:
Can I know the last date of passage on a plot that has been visited several times? Can we do calculations in a pulldata ? Can the pulldata query the form service itself? I think so, it's a service like any other.
Besides, it makes me think that this method can be used if you want to do an incrementation on continuous numbering like tree numbering (pulladat + 1) So can we imagine making a …,”attribute.max(value),”… Thank you for your many feedback..

PoleSIG

 

0 Kudos
2 Replies
IsmaelChivite
Esri Notable Contributor

I think this could be done by adding extra parameters to the URL as described in the Request Parameters section of this help topic.

For example: 

pulldata("@layer", "getValueAt", "attributes.dateCollected", "<yourFLURL>/0?orderByFields=dateCollected DESC&resultOffset=1", ${Location})

Note that the URL includes a ? sign and then extra parameters to refine the query: sort by date in descending order and return only one record. That would give you the record with the most recent dateCollected date.

Hope this helps.

0 Kudos
BNix_TPA
Emerging Contributor

HI,

I'm using the example you published above, but it doesn't seem to be pulling the most recent record, it pulls the second oldest record.  If I drop the resultOffset=1, it pulls the oldest record instead of the newest. Below is what I have in my spreadsheet:

pulldata("@layer", "getValue",

"attributes.inspection_date","https://services5.arcgis.com/YTApDBs0YanBdxkq/arcgis/rest/services/service_d05d28403a9d4482a58f367dc...", ${where2})

 

${where2} = concat("asset_id = '", ${asset_id}, "'")

0 Kudos