Complex If statement

1. What is the problem? Be very detailed.

Error: ODK Validate Errors:

XForm is invalid. See above for the errors.
: Invalid calculate for the bind attached to "${v_fcs}" : Couldn't understand the expression starting at this point: .../fcs >=42,'0','͎error')))) in expression if( ${fcs} <=28.4,'3','if( ${fcs} >=28.5 and ${fcs} <=35.4,'2',if( ${fcs} >=35.5 and ${fcs} <42,'1',if( ${fcs} >=42,'0','error'))))

The following files failed validation:
${encuesta_erd_ven}.xml

Result: Invalid

2. What app or server are you using and on what device and operating system? Include version numbers. I am testing in https://getodk.org/xlsform/ and ONA.IO

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

4. What steps can we take to reproduce the problem?

Integer constraint . >=0 and . <=7
Integer constraint . >=0 and . <=7
Integer constraint . >=0 and . <=7

calculate fcs (${number1}*2)+(${number2}*4)+(${number3}*3)
calculate v_fcs if(${fcs}<=28.4,'3','if(${fcs}>=28.5 and ${fcs}<=35.4,'2',if(${fcs}>=35.5 and ${fcs}<42,'1',if(${fcs}>=42,'0','error'))))

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

Your second if statement has a quotation mark in front of it.

Thank you very much!

I could fix it.

The solution is:

if((${value} <= 4), '0', if((${value} >= 5 and ${value} <=20), '2', if((${value} > 21), '3','error')))

Best,