Select to view content in your preferred language

Survey123 Connect calculation not translating to Survey123 web form

187
2
3 weeks ago
JohnathanAdkins
Emerging Contributor

I am building a survey in Survey123 Connect that I want users to collect data with the option of both the Survey123 app or web viewer. I have a fields in the Survey123 Connect that calculate time durations based off of a start and end time. These calculations work when filling out the survey with the app BUT they do not when filling out the form with the web format. I get a "NaN" value for my note where the calculation takes place, that also appears in the feature layer when the survey is submitted. 

I will attach my xlsx file as an example. I currently have my time duration fields set up to convert strings to integers but this has not worked. I tried to correct this by converting the duration to demical-date-time Example: int((decimal-date-time(${end_time}) - decimal-date-time(${start_time})) * 24*60) but this did not work as well. I am working out of Survey123 Connect Version 3.22 and made sure that the web version is in the right version too. 

If I cannot provide users the option to work out of either the Survey123 App  or on the web format, I would prefer to just have the web format work with functioning time durations

Any assistance would be greatly appreciated!

0 Kudos
2 Replies
DougBrowning
MVP Esteemed Contributor

I would try this to start.  Wrap each one in an int

(int(decimal-date-time(${end_time})) - int(decimal-date-time(${start_time}))) * 24*60

abureaux
MVP Frequent Contributor

@DougBrowning's answer will work. I just thought I'd provide some more context.

NaN = Not a number


Time fields, which you are using in your calculations, are essentially text fields. This is why forcing the app into thinking those values are actually numbers should work. It's more of a "bug" that it lets you do math with text values than not.

0 Kudos