How to extract Last Edit Date from REST url for feature

329
3
12-20-2021 04:52 PM
CalebAnderson
New Contributor II

What I'm trying to do is show the Last Edit Date for a feature in a Dashboard. I can see the last edit date in the REST URL but I'm not sure how to extract it in a format that can be posted to an Element in a Dashboard. I understand that Dashboards have the ability to say when they were last updated but I'm interested in reporting when the feature, that the dashboard is pointing to, was last updated. It can often be misleading when the dashboard says it was updated seconds ago but the data hasn't been updated for hours. 

Seems like it should be simple enough with a custom URL, or Arcade, but I can't figure it out.

Thanks for the help.

3 Replies
JoshKalovGIS
New Contributor III

We use a List element that is set to display one feature, sorted by last edited date descending, to show when the feature layer was last updated. 

JoshKalovGIS_0-1640055050003.png 

JoshKalovGIS_1-1640055148019.png

 

See it live at: https://maps.cookcountyil.gov/medexamcovid19/ 

 

0 Kudos
CalebAnderson
New Contributor II

Good suggestion thanks. We looked at doing this but the current data set we're uploading to AGOL does not have these fields. We could add them, of course, but this would force a few changes upstream that I was hoping to avoid. Also, there are often instances where the dataset does get updated, but there are no changes (we upload the data to AGOL every 10 minutes). Either way, going to keep this in my back pocket thanks.

0 Kudos
JoshKalovGIS
New Contributor III

Yeah, its all a workaround for not having an easy way to display when the layer was last touched. I guess with the ability to embed in a dashboard now, if you got the update date to display on a separate html page you host somewhere else, you could embed it.

You could potentially add the editor tracking fields on the AGOL layer and not anything upstream. Depending on how you are updating the layer, the AGOL update would trigger an update in the AGOL editor tracking, but if no records are actually getting updated that might not work.

Another idea is a separate hosted layer that is just an update log. Every time your script updates the main layer, it could add a new record to the update log layer with the latest timestamp.  (Or just overwrite and have one record with the latest update timestamp if you don't care about maintaining a history). Then this layer's record could be what is displayed in the dashboard "Data Last Updated" box.

FeatureLayerNameDataUpdateTimestamp
myFeatureLayer2021-12-21 12:00pm
myFeatureLayer2021-12-21 12:10pm