Uploading form errors, improving formulas

I am having this error when tring to deploy the foorm. how can i make the formula to calculte automatically the nombre des plantules.**1. What is the issue? Please be detailed.**unable to deploy
your form cannot be deployed because it contains errors:

ODK Validate Errors: >> XForm is invalid. See above for the errors. : Invalid calculate for the bind attached to "${plantules_Ha_necessaire_calcul}" : Bad node: org.javarosa.xpath.parser.ast.ASTNodeAbstractExpr@3cb1ffe6 in expression if(selected( ${ecartement_choice} , '2x2'), ${superficie} 2500(1+( ${degats_total} div100))),if(selected( ${ecartement_choice} , '2.5x2.5'), ${superficie} 1600(1+( ${degats_total} div100))), if(selected( ${ecartement_choice} , '3x3'), ${superficie} 1111(1+( ${degats_total} div100))) The following files failed validation: ${tmpbjkuli33} Result: Invalid
aTDwYrVZp5nKJKTEphjfCm.xlsx (25.6 KB)

2. What steps can we take to reproduce this issue?

3. What have you tried to fix the issue?

4. Upload any forms or screenshots you can share publicly below.

Your last embedded if(<cond>, <value if true>, <value if false>) statement appears to be missing its false bit. Specifically:

... if(selected(${ecartement_choice}, '3x3'),

so when the condition selected(${ecartement_choice}, '3x3') evaluates to true, then the if() function will return ${superficie}*1111*(1+(${degats_total}div100))

but you dont specify what it should return when the condition evaluates to false...


can someone help me in this see hoz i did it but it's not working: if(selected(${ecartement_choice}, '2x2'),(${superficie}2500(${degats_total}div100)),0), if(selected(${ecartement_choice}, '2.5x2.5'), (${superficie}1600(${degats_total}div100)),0), if(selected(${ecartement_choice}, '3x3'),(${superficie}1111(${degats_total}div100)),0)
i want it to return 0 if the condition is not true:

I think the calculation should look like:

if(selected(${ecartement_choice}, '2x2'),
	${superficie}*2500*(1+(${degats_total} div 100)),
	if(selected(${ecartement_choice}, '2.5x2.5'), 
		${superficie}*1600*(1+(${degats_total} div 100)), 
		if(selected(${ecartement_choice}, '3x3'), 
			${superficie}*1111*(1+(${degats_total} div 100)), 0
1 Like