Menu

Logic operators and parenthesis

Logic operators and and or

The syntax used to define rules makes it possible to create several conditions within the same rule. Conditions will remain defined in the same way with the only difference being that the keyword will be inserted between the conditions.

Keywords will be and and or. They make it possible to define how the rule engine will translate the succession of these rules. The and corresponds to inclusion and or exclusion.

Example:

ALLOW if #amount < 1000 and #card_country = 'FRA'

The previous example authorises payments whose amount is less than 10 AND and whose card is French. If one or other of the defined conditions is not compliant, the action will not be executed.

Example:

ALLOW if #amount < 1000 or #card_country = 'FRA'

The previous example authorises payments whose amount is less than 10 OR and whose card is French. If one or other of the defined conditions is not compliant, the action will not be executed.

Parenthesis

The use of parenthesis in the definition of a multi-condition rule enables to define units of conditions and priorities among these units. The principle is the same as the one of the priorities for mathematical operators.

Example:

ALLOW if #amount < 1000 and (#card_country = 'FRA' or #currency = 'EUR')

In the previous example, the rule engine will first interpret the unit (#card_country = 'FRA' or #currency = 'EUR'). That is, the payment will be authorised if “(the card is French or the currency is the euro) AND the amount is less than 10.