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:
Duration misfunctioning:
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
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