Calculations not functioning the same with upgrade

2005
12
09-30-2016 05:58 AM
DanSenner
Occasional Contributor

Hi, I upgraded Survey123 to 1.8 yesterday and noticed that some basic calculations have stopped working as they did in the previous version.  In the previous version of Survey123 Debris Removal & Woody Vegetation Subtotals were calculated based on a users input, the user did not have to populate all values for for the subtotal to calculate.  Now the form will not populate the subtotal unless all subsequent fields are populated.  The same is true for the work order total cost, previously a user could select various issues(not all) and the work order total would calculate now it will only populate if all Issues are selected and all fields populated.  Any ideas of what I am doing wrong or what changed would be helpful. 

More Information

If a user selected Debris Removal they did not have to populate all fields small, medium, large, and x-large for the subtotal to populate.  The user could pick say small and x-large and the subtotal would be calculated.

Similar to this is my calculation for the work order total worked on the previous version where a user could select a single issue or multiple issues and the work order total would calculate.  Now the work order total will only calculate if all issues are selected and all fields are populated.

Thanks

Dan Senner

0 Kudos
12 Replies
JamesTedrick
Esri Esteemed Contributor

Hi,

We did change how empty fields were handled with this release to have consistent and expected results across all areas that calculations are evaluated (relevancy, constraints and calculations).  We will be explaining in more detail later, but empty integers and decimals fields now evaluate to "Not a Number" (NaN) whereas they previously evaluated to 0.  If you provide a default value of 0 for your quantity fields, the form will work as expected.

0 Kudos
FinnianO_Connor
Occasional Contributor II

Hi JTedrick-esristaff,

I'm experiencing a similar issue with the latest version on the iPhone.

Calculate field returning NaN

The final calculate field from the image (ResChg_Area_Avg) is now returning a NaN value. I've tried setting default values for each of the calculate fields but this has no change.

Any thoughts as to a fix?

Cheers,

Finnian

0 Kudos
JamesTedrick
Esri Esteemed Contributor

The calculated values are stored as strings.  This isn't apparent in the rounding functions as the round() function attempts to change the value to a number before rounding, but is evident in the averaging calculation.  Explicitly change them to numbers using the number() function in the averaging equation. Alternatively, you can add a column to the Excel sheet labelled 'bind::type' and set the value to 'decimal' for the calculate rows; this will instruct Survey123 to store the values as numbers.

0 Kudos
FinnianO_Connor
Occasional Contributor II

That's great James, setting the bind::type column to decimal fixes the issue.

Many thanks,

Finnian

0 Kudos
by Anonymous User
Not applicable

I don´t have a column called Bind::Type and I couldn´t add decimal to the column bind::esri:fieldType

My calculations in a Survey doesn´t work anymore and setting the default to zero doesn´t solve the problem.

0 Kudos
FinnianO_Connor
Occasional Contributor II

You can create the new column yourself. It wasn't in the template I was working with either.

Cheers,

Finnian

0 Kudos
by Anonymous User
Not applicable

Thanks! I tried that but it didn´t solve the problem.  I have some ideas that may work that I will try tomorrow.

Take a look at Row 207-212.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Can you share your xls file?

0 Kudos
by Anonymous User
Not applicable

Okej- I did it in the post above

0 Kudos