Combinations of conditions

You can apply conditions to groups, and test nested groups.

You can use logical operators to combine conditions in the if part of a rule.

The following if statement contains one condition:

if the category of customer is Gold

In the following if statement, the logical operator and links two conditions:

if the category of customer is Gold and the age of customer is at least 65

Precedence of and over or

When the logical operators and and or link conditions in the if part of a rule, the and operator takes precedence over the or operator.

Consider the following if statement:

if 
	the age of customer is more than 60 
	or the age of customer is less than 21 
	and the category of customer is Student

The statement is true if either of the following conditions is true:

  • The customer is older than 60
  • The customer is younger than 21 and a student

Multiple conditions and parentheses

You can use parentheses to clarify the precedence of logical operators.

In the following if statement, parentheses group an age limit with a category:

if 
	the age of customer is more than 60 
	or (the age of customer is less than 21 and the category of customer is Student) 

You can also use parentheses to change the interpretation of conditions.

In the following if statement, the condition in parentheses is met if the customer is a student older than 60 or younger than 21:

if 
	(the age of customer is more than 60 or the age of customer is less than 21) 
	and the category of customer is Student

Multiple conditions that use the same logical operator

You can group conditions and apply the same logical operator to all the conditions in the group by using these statements:

  • all of the following conditions are true: This business term links all the conditions in the group with the logical operator and.
  • any of the following conditions is true: This business term links all the conditions in the group with the logical operator or.

In the following rule, the action is performed only when both conditions are true:

if 
	all of the following conditions are true: 
		- the category of customer is Gold 
		- a member of the Gold team is available 
then 
	set message to "Redirect the call to a member of the Gold team"; 

In the following example, the action is performed if the customer’s category is Gold or the customer has been waiting for longer than five minutes:

if 
	any of the following conditions is true: 
		- the category of customer is Gold 
		- the waiting time of customer is more than 5 
then 
	set message to "Redirect the call to a member of the Gold team";