Select to view content in your preferred language

Survey123: Calculation field acting fine in Survey connect, but misfunctioning in actual AGOL survey form

05-04-2021 09:37 AM
New Contributor II


I followed a thread that covered how to calculate the duration using a stop and start time. while I was successful in getting this to work in the connect form, I was unsuccessful in the AGOL form as it stated: "NaN:NaN". Additionally, When i started filling in values for stop and start time in the actual form, the duration would just go to "00:00". Any tips? This is the calculation I used for my duration field: 

concat(int((${StopTime} - ${StartTime}) div (1000*60*60)), ":", if(int(((${StopTime} - ${StartTime}) div (1000*60)) mod 60) < 10,"0",""), int(((${StopTime} - ${StartTime}) div (1000*60)) mod 60))


Duration acting fine:


Duration misfunctioning:




0 Kudos
2 Replies
Esri Regular Contributor

Hi @SummerlynBingaman 

The web app only supports decimal time, while Connect and the field app support both Epoch time and decimal time. Converting your dateTime questions to decimal time using the decimal-date-time() function should do the trick.

For more info please see the Dates and Time in Survey123 blog post and the Decimal date time documentation. There's also a Dates and Times sample XLSForm in Connect that has some examples (in particular, see the calculation for lunch break duration).

Hope this helps. Best, Jim 

0 Kudos
Occasional Contributor II

Hello @SummerlynBingaman,

I am searching for the post you are referring to. I also found it at some point and am trying locate it again. Any chance you have it bookmarked and can share. 

I guess I should also ask if it ever worked for you or if you found a better way to do it since this post. 

Thank you,

Jessica Thompson

0 Kudos