Select to view content in your preferred language

Auto-calculate/populate Response Time Field

877
5
06-02-2022 11:09 AM
JasonCyphers
Frequent Contributor

I have a hosted feature layer in AGOL with "Dispatch Time", "On Scene Time", and "Response Time" attributes.

Is there a way to automatically calculate and populate the Response Time attribute with the calculated difference between the On-Scene Time and Dispatch Time, in minutes?  Something that is automatically done each time a new record is added, so that I can build a dashboard to show an Average Response Time indicator widget?

0 Kudos
5 Replies
tigerwoulds
Frequent Contributor
0 Kudos
MaryAnne_VanZuyle
Occasional Contributor

I am stuck on a similar issue right now. The DateAdd and DateDiff functions work in Map Viewer and Test perfectly in a Calculated Expression associated with an Atrribute in the form design. But it fails in Field Maps. I am wondering if these two Arcade functions work in Field Maps.

0 Kudos
JasonCyphers
Frequent Contributor

That's something I'd have to manually do though, correct?  I'm looking for a way to do it automatically, anytime a new record is added.

0 Kudos
tigerwoulds
Frequent Contributor

You're right.

In order to do this, you would need to publish to ArcGIS Enterprise rather than using hosted feature layers in AGO. With ArcGIS Enterprise, you set up Attribute Rules in ArcGIS Pro, and publish your service from a registered data store. Then, your Response Time will dynamically update based on the Dispatch and On Scene values. Currently, AGO does not support Attribute Rules. 

Another potential solution (although not 100% dynamic), write a python script using the ArcGIS Python API that will handle the calculation. If you put it on a task schedular, it can update the hosted feature layer in near real-time automatically. 

0 Kudos
JasonCyphers
Frequent Contributor

Is there a way to display the difference between times (to get a response time) in a dashboard and an indicator widget?  What would the arcade expression look like?

0 Kudos