Operators
Expression Language supports a number of standard operators that can operate upon variables, primitive values, or both. Every expression builder on the platform, such as those inside the rules engine, contains a full list of available operators. Several types of available operators are listed here:
Arithmetic Operations
Operator |
Use |
EL Expression |
Result |
+ |
Add |
${1.2E4+1.4} |
12001.4 |
- |
Subtract or negative value |
${-72-8} |
-80 |
* |
Multiply |
${2.5*10} |
25 |
/ (or) div |
Divide |
${3 div 4} |
0.75 |
% (or) mod |
Modulo (remainder) |
${10 mod 4} |
2 |
Logic Operations
Operator |
Use |
EL Expression |
Result |
and |
Test for logical AND |
${2>1 and ;b' > 'c'} |
false |
or |
Test for logical OR |
${2>1 or 'b' > 'c'} |
true |
not (or) ! |
Unary boolean complement |
${!empty param.Add} |
False if the request parameter named Add is null or an empty string. |
Relational Operations
Operator |
Use |
EL Expression |
Result |
= (or) eq |
Test for equality |
${150.0 == 150} |
True |
!=(or) ne |
Test for inequality |
${(10*10) ne 100} |
False |
< (or) lt |
Test for less than |
${'a' < 'b'} |
True |
> (or) gt |
Test for greater than |
${'hip' gt 'hit'} |
False |
<== (or) ge |
Test for greater than or equal |
${3 ge 3} |
True |
>== (or) le |
Test for less than or equal |
${4.1 >==3} |
True |
Empty Operation
Operator |
Use |
EL Expression |
Result |
empty |
Test for empty value |
${!empty param.Add} |
False if the request parameter named Add is null or an empty string. |
Conditional Operation
This is the equivent of an “if, then, else” statement – the operator requires 3 inputs, a testable condition that results in a Boolean (true or false), where when the condition is true, the variable to the right of the test is applied, if false the third variable is evaluated.
Operator |
Use |
EL Expression |
Result |
?: |
Ternary operator–(3 inputs). Test for potential outcomes. |
${empty field.value ? 1 : field.value +1} |
1 if a field.value is empty or field.value + 1. |