Convert Elapsed Time in ArcGIS Dashboards

810
4
08-06-2021 11:38 AM
shildebrand
Occasional Contributor

Does anyone know if there is a way to convert a known length of time (in this case the number of minutes estimated for a sewer overflow) to hours, minutes, and seconds?  Currently I am displaying the number of minutes (stored in a double field in a feature service) as an indicator in my dashboard.  Any suggestions would be greatly appreciated.

0 Kudos
4 Replies
jcarlson
MVP Esteemed Contributor

You can use the built in value conversion in an indicator.

jcarlson_0-1628276021557.png

If that 50 represented minutes, converting it to hours would be as simple as applying a factor of 1/60, or .01666, and the result is now in hours.

jcarlson_1-1628276099875.png

 

- Josh Carlson
Kendall County GIS
shildebrand
Occasional Contributor

Thanks Josh, that's better than showing minutes.  Any thoughts on how to represent the hours and seconds?  I'm thinking there is probably some kind of arcade expression that could be written.

0 Kudos
jcarlson
MVP Esteemed Contributor

Ah, you mean like "2 hours, 26 minutes, 15 seconds". That would have to be an arcade expression. For an example, I'll use 137.9 minutes. This is using a feature-based indicator with Arcade enabled.

var dur = $datapoint['duration-field'] // 137.9 used for test
var s = (dur * 60) % 60
var m = Floor(dur) % 60
var h = (Floor(dur) - m) / 60

return {
    topText: `${dur} minutes`,
    topTextMaxSize: 'medium',
    middleText: `${h} hours, ${m} minutes, ${s} seconds`,
    middleTextMaxSize: 'large'
  }

 

Which results in:

jcarlson_0-1628860515854.png

 

- Josh Carlson
Kendall County GIS
shildebrand
Occasional Contributor

Thanks Josh, that was exactly what I was looking for!  I appreciate your time and effort on this!

0 Kudos