How do I combine multiple variables (more than two) in the scripted expression using the IF function? Compare the two images below (first works, but second one throws an error and does not seem to compute)

This works

This one does not work


In the screenshot that is failing you need to rename your variable to match the if statement, or you need to rename your reference used inside of the statement to match your variable name.


As a good practice put the multiple AND portion of the statement in parenthesis like so:

Without Renaming your variable:

0 if (var > -0.5 and var < 0.5 and var_001 > -0.5 and var_001 < 1) else 2

With renaming the variable:

0 if (var > -0.5 and var < 0.5 and var2 > -0.5 and var2 < 1) else 2
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.