Select to view content in your preferred language

Why do calculate questions act differently in the field app vs. the desktop app?

607
4
10-07-2019 12:57 PM
JeremyDiehl
Emerging Contributor

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. ???

0 Kudos
4 Replies
Shwu-jingJeng
Esri Regular Contributor

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? 

0 Kudos
JeremyDiehl
Emerging Contributor

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

0 Kudos
JamesTedrick
Esri Esteemed Contributor

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)

0 Kudos
JeremyDiehl
Emerging Contributor

Thank you, James. I will give this a try.

Jeremy

0 Kudos