Product Administration Guide > Configuration Rule Template Reference >

Compound Logic and Comparison Operators


Both Compound Logic and Comparison operators test for the truth of their operands. They return a true or false rather than a quantity.

Compound Logic operators, such as AND, NOT, OR, are used to link expressions together when creating a rule. For example: (Condition A AND Condition B) requires Item C. Compound Logic operators are also called Boolean operators.

Table 31 presents the Compound Logic operators you can use with rule templates.

Table 31.  Compound Logic Operators
Operator
Example                
Description
Not
NOT A
Logical negation. True when A is false and false when A is true. A can be an item or sub-expression.
And
A AND B
Both A and B. True only when both A and B are true. When used as a top-level constraint, means that only solutions where both A and B are true are allowed. A and B can be items or sub-expressions.
Or
A OR B
Either A or B or both. False only when both A and B are false. A and B can be items or sub-expressions.
Exclusive Or
A XOR B
A or B but not both. A and B must have opposite truth states. False when A and B are either both true or both false. A and B can be items or sub-expressions.
NAND
NOT (A AND B)
Converse of A AND B. False only when both A and B are true. When used as a top-level constraint, means that A and B cannot both be present. A and B can be items or sub-expressions.

Comparison operators compare their operands and return a true or false. In the following rule, when the quantity of item A is less than item B (when the comparison is true), then item C is required.

(Item A < Item B) requires C

If you specify an item as an operand in a comparison, the quantity of the item in the solution is used to make the comparison. If you specify an expression as an operand, the expression must resolve to a number.

If you specify an expression that resolves to true or false, then true is assigned the value 1 and false is assigned the value 0.

Table 32 presents the Comparison operators you can use with rule templates.

Table 32.  Comparison Operators
Operator
Example                      
Description
Greater than
A > B
A is greater than B
Not less than
A >= B
A is greater than or equal to B
Equals
A == B
A equals B
Equals (compound)
A==B==C==D
True if A=B AND A=C And A=D
Not equal to
A <> B
A does not equal B
Not greater than
A <= B
A is less than or equal to B
Less than
A < B
A is less than B

When you are building a rule, you can compound the comparison operators. For example, you could build the following expression:

(A>B>C>D)

This expression is equivalent to the following expression:

A>B AND A>C AND A>D


 Product Administration Guide 
 Published: 23 June 2003