Errors running conditional calculations in survey123

318
3
01-13-2022 03:32 PM
ShawnMcCauley
New Contributor II

I can't get this to run and i'm out of ideas/time and need to move on. 

Any help would be appreciated 

Basically 2 calculations, that run according to the unit of measurement selected. 

 

if(selected(${Rate1Units},'oz'),(int(${Product1Rate}*int(${Total_Batches}div128),if(selected(${Rate1Units},'lbs'),int(${Product1Rate}*int(${Total_Batches}))

0 Kudos
3 Replies
DougBrowning
MVP Esteemed Contributor

if(selected(${Rate1Units},'oz'), int(${Product1Rate})*int(${Total_Batches}) div 128), int(${Product1Rate}) * int(${Total_Batches}))

you were missing the ending ) in each int.  Also have no spaces after div.  Finally if it is just 2 possible choices then no need for the second if.

Hope that does it.

ShawnMcCauley
New Contributor II

Thanks for the help Doug! I'm definitely closer now but it still throws out the "unbalanced brackets/parenthesis error.  

0 Kudos
ShawnMcCauley
New Contributor II

i removed the parenthesis after 128 and i think that fixed it.

thanks again Doug