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?
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.
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.
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.
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?