Operators
Use the following operators to model the rule expressions or conditions.
The operators are listed in the autosuggest list only if they are relevant for the rule expression.
Mathematical Operators
Mathematical operators let you perform binary operations.
|
Operator Name |
Operator Syntax |
Example |
|---|---|---|
|
add |
+ |
product.amount + product.taxvalue |
|
subtract |
- |
product.total - product.discount |
|
multiply |
* |
product.amount * product.taxrate |
|
divide |
/ |
product.totalamount / COUNT(products) |
Logical Operators
Logical operators let you perform logical operations. These operations return a boolean value.
|
Operator Name |
Operator Syntax |
Examples |
|---|---|---|
|
and |
AND |
customer.name = 'John' AND customer.country ='INDIA' |
|
or |
OR |
customer.country = 'US' OR customer.country ='INDIA' |
|
not |
NOT |
NOT('John') |
Comparison Operators
Comparison operators compare fixed values, data objects, or rule expressions and return true or false.
|
Operator Name |
Operator Syntax |
Examples |
|---|---|---|
|
is equal to |
= |
order.productD = product.ID |
|
is not equal to |
!= |
order.productD != product.ID |
|
is greater than |
> |
wallet.balance > order.total |
|
is equal to or greater than |
>= |
wallet.balance >= order.total |
|
is less than |
< |
wallet.balance < order.total |
|
is equal to or less than |
<= |
wallet.balance <= order.total |
Range Operators
Range operators check for a particular value in a range of continuous values and return true if it is within the range. If not, they return false. You can choose to include or exclude the upper and lower values of the range.
|
Operator Name |
Operator Syntax |
Examples |
|---|---|---|
|
in |
IN |
customer.score IN (1..10) |
|
not in |
NOTIN |
customer.score NOTIN (1..10] |
Array Operators
Array operators check for a particular value in an array of values and return true if the value is present in the array. If not, they return false.
|
Operator Name |
Operator Syntax |
Examples |
|---|---|---|
|
exists in |
EXISTSIN |
customer.country EXISTSIN ['IND','GER','AUS'] |
|
does not exist in |
NOTEXISTSIN |
customer.country NOTEXISTSIN ['IND','GER','AUS'] |
Functional Operators
Functional operators perform operations on strings or expressions that return a string value.
|
Operator Name |
Operator Syntax |
Examples |
|---|---|---|
|
matches |
MATCHES |
customer.name MATCHES 'Jo.*' customer.name MATCHES '*Dr\.*|*Mr\.*' |
|
does not match |
NOTMATCHES |
customer.name NOTMATCHES 'Jo.' |
|
contains string |
CONTAINS |
customer.name CONTAINS 'Dr.' |
|
does not contain string |
NOTCONTAINS |
customer.name NOTCONTAINS 'Dr.' |
|
starts with |
STARTSWITH |
customer.name STARTSWITH 'J' |
|
does not start with |
NOTSTARTSWITH |
customer.name NOTSTARTSWITH 'J'' |
|
ends with |
ENDSWITH |
customer.name ENDSWITH 'J' |
|
does not end with |
NOTENDSWITH |
customer.name NOTENDSWITH 'J' |