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

293
1
05-04-2021 09:37 AM
SummerlynBingaman
New Contributor II

Hello!

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))

Thanks!

Duration acting fine:

SummerlynBingaman_0-1620146087275.png

Duration misfunctioning:

SummerlynBingaman_1-1620146136800.png

 

 

0 Kudos
1 Reply
Jim-Moore
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