Select to view content in your preferred language

Survey 123 Calculate Field Causing Parsing Errors

1003
7
08-17-2023 01:13 PM
ClaytonWells
Emerging Contributor

Hello,

I am new to survey123 and still trying to figure out the syntax in the XLSX Form through Connect. I have attached a copy of the form as well as a sheet with the specific cells I am having problems with. I am trying to do some bridge scour calculations within the survey123 field app so that surveyors on the ground can easily get answers from their input data that will help them fill out the survey without having to do the math elsewhere. When I try to save the form to the survey it gives me an error saying that it cannot parse the fields which I have entered the calculations into. Any help would be appreciated but I think that the answer would be fairly obvious to any one of you survey wizards.

Thanks.

ProblemCalculations.JPGXLSXForm.JPGXLSXForm1.JPG

 

Tags (1)
0 Kudos
7 Replies
DougBrowning
MVP Esteemed Contributor

Quick look and you cannot use / or \ for divide since that is a special char for formatting and such.  It is actually div.  So 5 div 3 for example

Bookmark this page it tells you about all the formulas  

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm

Hope that helps

0 Kudos
ClaytonWells
Emerging Contributor

Thank you for your reply, unfortunately after fixing that issue and reviewing all of the other formulas the form still will not parse.

0 Kudos
DougBrowning
MVP Esteemed Contributor

I see a few field names start with underscore.  That is not allowed.  Try that next.  https://support.esri.com/en-us/knowledge-base/faq-what-characters-should-not-be-used-in-arcgis-for-f... 

Also can you post the actual error.  

0 Kudos
ClaytonWells
Emerging Contributor

Hey Doug,

The underscore doesn't seem to be a problem, the survey created those field names and when changing them I received an error related to the removing of the underscore. 

Here is the error I am receiving. "b'ODK Validate Errors:\n>> XForm is invalid. See above for the errors. \norg.javaroasa.xform.parse.XFormParseException: Invalid calculate for the bind attached to "${froude_number_at_bridge_contrac}" : Unexpected beginning path in expression ${velocity_at_bridge_contraction} / (32.2 * (${flow_depth_at_bridge_contractio} * exp(0.5)))\n\nResult: Invalid'"

0 Kudos
DougBrowning
MVP Esteemed Contributor

Looks like you still have a / in there

${velocity_at_bridge_contraction} / (32.2 * (${flow_depth_at_bridge_contractio} * exp(0.5)))

0 Kudos
ClaytonWells
Emerging Contributor

Apologies for the confusion, I did fix that issue, I sent you a previous error message and not the current one that shows the changes I have made. Here is the updated error message ""b'ODK Validate Errors:\n>> XForm is invalid. See above for the errors. \norg.javaroasa.xform.parse.XFormParseException: Invalid calculate for the bind attached to "${froude_number_at_bridge_contrac}" : Couldn\'t understand the expression starting at this point: ...dge_contractio\xcd\z8eexp(0.5))) in expression ${velocity_at_bridge_contraction} div (32.2 * (${flow_depth_at_bridge_contractio} exp(0.5)))\n\nResult: Invalid'"

0 Kudos
TylerGraham2
Frequent Contributor

You're missing an operator between ${flow_depth_at_bridge_contractio} and exp(0.5)

Your formulas as written returns your error :${velocity_at_bridge_contraction} div (32.2*(${flow_depth_at_bridge_contractio}exp(0.5)))

 

Adding an operator, in this case multiplying ${flow_depth_at_bridge_contractio} by exp(0.5), results in a valid expression.

This works with no error: ${velocity_at_bridge_contraction} div (32.2*(${flow_depth_at_bridge_contractio} * exp(0.5)))