I have a form created in Survey 123 Connect that uses answers to previous questions to calculate a "Total" field.
The fields are all forced integers defaulted to 0. The "Total" field calculates correctly when submitted via the field app, but does not calculate when submitted through the desktop application. ???
Hi Jeremy,
What build of the field app are you using? And is the windows desktop version of field app you are having issue with? Could you share your xls form with us to take a look?
Good morning,
I am using version 3.6.153 of the field app.
Correct, it is the windows version of the field app I am having issues with.
I am using version 3.2.196 of the Survey123 Connect app.
My xls form is attached. Line 13 contains the relevant statement and calculation.
I ask that you please not share the xls publicly.
Thank you,
Jeremy Diehl
GIS Management Technician
Pennsylvania Game Commission
jerdiehl@pa.gov<mailto:jerdiehl@pa.gov>
cellular: (717) 418-0584
Hi Jeremy,
When a question is non-relevant, it does not have a value, it is null; this was made more stringent with the current release of Survey123. Null used in an mathematical operation will result in null. This is causing an issue you are seeing. In your total calculation, you should use the coalesce() function with each value to catch if it is non-relevant and instead provide another value (0) instead:
coalesce(int(${number_of_adults}),0)+coalesce(int(${number_of_juveniles}),0)+coalesce(int(${unknown_age_total}),0)
Thank you, James. I will give this a try.
Jeremy