NIPO ODIN Version 5.17

Previous Topic

Next Topic

Common Mistakes in Expressions

This section describes common mistakes made in expressions, where a syntax check does not reject the syntax used but where a misunderstanding exists on how the expression is evaluated. These examples focus of filtering constructions.

Incorrect expressions and how to correct them

Incorrect expression What it was intended to do What it does Correct expression

*IF [20 < Q2 < 40]

Check if Q20 is between the values 20 and 40.

This firsts checks if 20 is smaller than Q2 (result 0 or 1) then if the result is smaller than Q40.

*IF [ Q2 > 20 & Q2 < 40 ]

*IF [Q20,3\4\5]

Check if Q20 has code 3, 4 or 5 marked.

This checks if Q20 has code 3. Then it checks if either the result of the expression, or 4, or 5 are true. Any value above 0 is always considered true, therefore the expression always results in 1.

*IF [ Q20,3,4,5 ]

*IF [ Q21=1,2,3 ]

Check if Q21 has code 1, 2 or 3 marked.

This checks if Q21 is equal to the expression 1,2,3. The latter expression checks if position 1 in the U-file contains a 2 or a 3.

*IF [ Q21,1,2,3 ]

*IF [ Q21 = 1-3 ]

Check if Q21 has code 1, 2 or 3 marked.

This checks if the value of Q21 equals -2 (1-3).

*IF [ Q21,1,2,3 ]

*IF [ #Q21 = 1 ]

Check if Q21 is not equal to 21

This first checks if Q21 is not empty, then compares the result to 1. In other words, the expression returns 1 if Q21 is not empty.

*IF [ #(Q21 = 1) ]

See Also