Combinaisons de conditions
Vous pouvez appliquer des conditions à des groupes et tester des groupes imbriqués.
Vous pouvez utiliser des opérateurs logiques pour combiner des conditions dans la partie if d'une règle.
L'instruction if suivante
contient une seule condition :
if the customer category is Gold
Dans l'instruction if suivante, l'opérateur logique and lie deux conditions :
if the category of the customer is Gold and the customer has been waiting longer than 5 minutes
Priorité de and sur or
Lorsque les opérateurs logiques " and et " or lient des conditions dans la partie " if d'une règle, l'opérateur " and est prioritaire sur l'opérateur " or.
Considérons l'instruction
if suivante :
si the customer is older than 60 or the customer is younger than 21 and the category of the customer is Student
L'instruction est vraie si l'une ou l'autre des conditions suivantes est vraie :
- Le client a plus de 60 ans
- Le client a moins de 21 ans et appartient à la catégorie Etudiants
Conditions multiples et parenthèses
Vous pouvez utiliser des parenthèses pour clarifier la priorité des opérateurs logiques.
Dans l'instruction
if suivante,
les parenthèses regroupent une limite d'âge avec une catégorie :
si the customer is older than 60 or (the customer is younger than 21 and the category of the customer is Student)
Vous pouvez aussi utiliser des parenthèses pour changer l'interprétation des conditions.
Dans l'instruction
if suivante,
la condition entre parenthèses est satisfaite si le client est un étudiant de plus
de 60 ans ou de moins de 21 ans :
si (the customer is older than 60 or the customer is younger than 21) and the category of the customer is Student
Conditions multiples reliées par le même opérateur logique
Vous pouvez grouper des conditions et appliquer le même opérateur logique à toutes les conditions du groupe en utilisant ces instructions :
all of the following conditions are true: Ce terme métier lie toutes les conditions dans le groupe avec l'opérateur logiqueand.any of the following conditions is true: Ce terme métier lie toutes les conditions dans le groupe avec l'opérateur logiqueor.
Dans la règle suivante, l'action n'est effectuée que lorsque les deux conditions sont vraies :
si all of the following conditions are true: - the category of the customer is Gold - a member of the Gold team is available alors redirect the call to a member of the Gold team;
Dans l'exemple suivant, l'action est effectuée si la catégorie du client est Or ou si le client attend depuis plus de cinq minutes :
si any of the following conditions is true: - the category of the customer is Gold - the customer has been waiting longer than 5 minutes alors redirect the call to a member of the Gold team;