Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Order of operations for logical operators?

For the logical operators (and, or, not, xor), what is the order of operations?

For example, if I say

condition1 or condition2 and condition3

Will it evaluate as

(condition1 or condition2) and condition3

or

condition1 or (condition2 and condition3)

?

Also, is it possible to use parentheses to change that behavior?

1 Reply
johnw
Champion III
Champion III

While I don't see it in the documentation, I would expect QlikView to implement the "standard" order of operations.  In other words (and I'm sure I'm missing some, and might have something wrong):

  1. terms inside parentheses
  2. multiplication and division
  3. addition and subtraction
  4. comparisons
  5. not
  6. and
  7. or
  8. assignment
  9. left to right

This should also answer your question about parentheses.  Yes, you can override with parentheses because they come first in the order of operations.

But why even ask when you can so easily test?  Type some expressions in and see what happens.