Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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?

2 Replies
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.

Ken_T
Specialist
Specialist

I think, one of the big purposes of a community is to document the stuff not documented, so thousands of people don't all have to waste time testing to trial and error how something works