If function

Hello, each time I type in the formula, if(${q1}=1 and ${q2}=0, “N.A.R”, if(${q1}=1 and ${q2}=1, “L.A.P”)), I get the error message below:

FormLogicError: Could not evaluate: if( /model/instance[1]/aLHXoLywHQbW4vy5YEpc7Q/q1 =1 and /model/instance[1]/aLHXoLywHQbW4vy5YEpc7Q/q2 =0, “N.A.R”, if( /model/instance[1]/aLHXoLywHQbW4vy5YEpc7Q/q1 =1 and /model/instance[1]/aLHXoLywHQbW4vy5YEpc7Q/q2 =1, “L.A.P”)), message: Cannot read properties of undefined (reading ‘t’)

Kindly assist.

Welcome @1994e,
The else part in the 2nd if is missing. Might be “” (empty).

Hint: I would suggest to always use the Online validator for checking the form during development and before deployment.

1 Like

Thanks for your contribution…What do you mean by “else part?”

if( condition, true-part, else(false)-part ).
See ODK XForms Specification

1 Like

Please try this one,

if(${q1}=1 and ${q2}=0, “N.A.R”, if(${q1}=1 and ${q2}=1, “L.A.P”,“error”))

1 Like

Thanks a lot

1 Like

Thanks a lot

1 Like

@wroos, @osmanburcu, :clap: :heart: :partying_face: