Arcade formula to show response time

984
2
11-17-2020 03:44 AM
CMcDonald
Occasional Contributor II

Hi,

is it possible to show the average response time on an ArcGIS Dashboard?

I have created a Hosted Feature Layer and there are two date type fields called Rep_Time (this is the Reported Date & Time) and Res_Time (this is the Response Date & Time).

What I would like to have is an Indicator Element displaying this in hours and minutes.

I found this post helpful https://www.esri.com/arcgis-blog/products/ops-dashboard/real-time/displaying-time-spans-with-arcade-... but too complicated for me I am afraid.

My Arcade expression looks like this (which even if it did work would probably only display seconds?)

var dateopened = $datapoint["Rep_Time"];
var datecleared = $datapoint["Res_Time"];
var secondsToRespond = $DateDiff(dateCleared, dateOpened, 'seconds');

Thanks.

0 Kudos
2 Replies
jcarlson
MVP Esteemed Contributor

Unless I'm mistaken, in the Dashboards Beta, you can only apply Arcade to the List item, and only on a per-feature basis.

Getting an aggregate such as an average requires that there be a numeric field to work with. You already have your arcade expression written, but what you'll need to do is add a new secondsToRespond field to the layer and then use that expression in the field calculator to populate it with values.

With a numeric field in the data, an indicator can access that and average it, and even apply a value conversion to show the response time in minutes or hours.

This does unfortunately require manually updating this field regularly to ensure that there is data in the new field. This would be simple enough to automate with the ArcGIS Python API. Where is the data coming from, by the way? There are ways to get an attribute to calculate upon submission via Survey123 as well, if that's an option for you.

- Josh Carlson
Kendall County GIS
0 Kudos
CMcDonald
Occasional Contributor II

The data sits in a Hosted Feature Layer and is maintained via a Web Mapping Application created using ArcGIS Web App Builder (currently no Edit Widget available in Web Experience Builder).

As this is my first attempt at a dashboard I'm on a learning curve at the moment.

I was hoping this would maybe be a simple bit of code however this possibly looks more complex 😞

0 Kudos