Survey123 XLSForm - "If" statement issues - Invalid Calculate + Bad node

1. What is the problem? Be very detailed.
Hello!

I created a Survey123 xlsform. for those who may be unaware, using and XLSform based survey in the Survey123 app acts much differently than opening the same survey in a browser.

within the app i had originally written a calculation:

if(${practice}="Cover Crop (340)(acres)",round(pulldata('covercrops','phosphorus','county',${county})${costshareac},2),if(${practice}="Conservation Cover (327)(acres)",round(pulldata('grassedpractices','phosphorus','county',${county})${costshareac},2),if(${practice}="Critical Area Planting (342) (acres)",round(pulldata('grassedpractices','phosphorus','county',${county})${costshareac},2),if(${practice}="Filter Strip (393)(acres)",round(pulldata('grassedpractices','phosphorus','county',${county})${costshareac},2),""))))

this worked great in the app - I am referencing some CSVs (grassedpractices.csv, covercrops.csv) in this formula. You'll notice there are multiple if statements here.

To make this work well on a browser, I had to move the pulldata into new calculation rows and then call them. Below is my workaround:

This works fine (s_1):

if(${practice}="Cover Crop (340)(acres)",${s_cov},0)

(s_cov):

pulldata('covercrops','sediment','county',${county})*${costshareac}

THIS is where things get weird - If I try to apply this to multiple "if" statements then we run into some problems.

Example (s_2):

if(${practice}="Cover Crop (340)(acres)",${s_gp},0),if(${practice}="Conservation Cover (327)(acres)",${s_gp},0),if(${practice}="Critical Area Planting (342) (acres)",${s_gp},0),if(${practice}="Filter Strip (393)(acres)",${s_gp},0)

when I try to string them together like I did before I recieve an XFormParseException error indicating a Bad node.

(s_gp) referenced in above formula:

pulldata('grassedpractices','sediment','county',${county})*${costshareac}

Error:

any obvious issues?

2. What app or server are you using and on what device and operating system? Include version numbers.

Survey123 - Web Browser (tested in Chrome, Firefox, and Edge).

Windows 10, excel 2013, survey123 connect for ArcGIS 3.5

3. What you have you tried to fix the problem?

so far I've tried:
-nesting the if statements, but it doesn't accomplish what I need.
-moving the pulldata rows above the if calculations
-creating a new row for each "if" (this works, but seems untidy and silly)
-changing the "type" to "hidden" and "decimal" rather than "calculate"
-putting many things in and out of parenthesis

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

I'm not attaching the form itself for privacy sake (certain choices), but if you really must have it I can make version that is gleaned of this information.

Thank you!
Trevor

Welcome to the ODK community! If you'd like to learn more about core ODK tools, see the documentation.

Survey123 is based on ODK standards but is its own proprietary product. Please see https://support.esri.com/en/products/apps/mobile-apps/survey123-for-arcgis for support.

Please do start with Survey123 support. You've described questions about compatibility issues within that tool suite and will be better served there. If there's an issue with the ODK tools they use, the support team will be able to submit a fix for those as needed.