8.4.3.2 Conditions


8.4.3.2.4 Right operand  <<  8.4.3.2.5  >>  8.4.3.3 Product targeting with condition tree 

8.4.3.2.5 Multiple conditions, parenthesis and condition evaluation order

If campaign has more than one condition, the conditions are connected to each other via a logical connective:


  • AND

  • OR

The connective determines if the left condition (top condition in the editor) AND the right condition (bottom condition in the editor) must both be true for them together to be true, OR is it enough if just one of them is true. Thus conditions are evaluated in the same manner than expressions in boolean logic. By default, the conditions are evaluated in the same order that they are displayed in the condition editor (from top to bottom). If AND and OR connectives are used together, this may cause ambiguity to the intended order in which the conditions should be evaluated. Parenthesis can be used to explicitly tell what the order should be.

Each condition has plus (+) and minus (-) buttons to the left and right of the condition. The buttons on the left are used to add/remove parenthesis to the left of the condition, the right buttons to add/remove parenthesis to the right of the condition. With parenthesis, multiple conditions can be grouped/paired together, in which case the group is evaluated first as a whole, before its result is evaluated to other parts of the expression. The innermost group is always evaluated first. Parenthesis can be nested.

When parenthesis are used, they must be balanced. When adding or removing parenthesis, they are colored black (in balance) or red (not in balance) to indicate whether all the parenthesis as a whole are in balance. A campaign with non-balanced parenthesis in the conditions can not be saved. If condition is removed from a condition expression that has parenthesis, then all of the parenthesis are automatically removed, and they must be added back manually.

Below is a simple example. The conditions are in a top-to-bottom order, as they are in the condition editor. In the first expression, if condition 1 is true, the expression as a whole is true, and conditions 2 and 3 are never evaluated. If condition 1 is true in the second expression, then condition 3 must also be true, for the expression as a whole to be true.
condition1
  OR
condition2
  AND
condition3

(condition1
   OR
 condition2)
   AND
 condition3


The use of parenthesis is not mandatory, and for simple cases that only contain one or two conditions, they are usually not needed.