Combinations of conditions

Combine several conditions in the if part of the rule.

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

The following statement contains one condition:

if the customer category is Gold

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

if the category of the customer is Gold and the customer has been waiting longer than 5 minutes 

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 'the customer' is more than 60 
	or the age of 'the customer' is less than 21 
	and the category of 'the 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 statement, parentheses group an age limit with a category:

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

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

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

if 
	(the age of 'the customer' is more than 60 or the age of 'the customer' is less than 21) 
	and the category of 'the 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 the customer is Gold 
		- there is at least one member in the members of 'the Gold team'
 then 
	print "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 the customer is Gold 
		- the waiting duration of 'the customer' in minutes is more than 5  
then 
	print "redirect the call to a member of the Gold team";