I've have some simple polyline features (routes with a StartTime and EndTime both in correct datetime formats).
In a Web Map I can create a popup/field with an arcade dateDiff() expression to calculate the travel time in hours for each feature.
dateDiff($datapoint["EndTime"], $datapoint["StartTime"], 'hours')
Within an ArcGIS Online dashboard (beta) I would like to add an indicator which shows the sum of all the travel times. e.g. if I had 3 features with an arcade popup calculated travel time of 1,2 and 5 hours - The indicator would show the sum of these (Total Hours - 8).
It appears that I can't reference the popup travel time field within the dashboard (also according to this - Arcade in ArcGIS Dashboards Beta - Esri Community) to do a simple SUM on that field.
The next thought was to use an arcade expression in the indicator, but that only allows me to recreate the popup expression. I tried to run a for loop within the expression, but I'm sure I cant create a global variable to hold any values, and therefore the expression is just run on a per-row basis.
var total_time = ''
for (var f in dateDiff($datapoint["EndTime"], $datapoint["StartTime"], 'hours') ){
total_time += f
}
Does anyone have any ideas?