Supported operators
Arithmetic Operators
+ (Addition)
{% 2 + 3 %} >> 5
- (Subtraction)
{% 7 – 4 %} >> 3
* (Multiplication)
{% 2 * 3 %} >> 6
/ (Division)
{% 9 / 3 %} >> 3
% (Modulus)
{% 10 % 3 %} >> 1
** (Pow)
{% 5 ** 2 %} >> 25
Logical Operators
! (not)
{% !true ? "true": "false" %} >> false
&& (And)
{% true && false ? "true": "false" %} >> false
|| (Or)
{% true || false ? "true": "false" %} >> true
Bitwise Operators
& (And)
{% 5 & 3 %} >> 1
| (Or)
{% 5 | 3 %} >> 7
^ (Xor)
{% 5 ^ 3 %} >> 6
The Bitwise operators are used to perform bit-level operations on the operands. The operators are first converted to bit-level and then calculated.
Comparison Operators
== (Equal)
{% 22 == '22' %} >> True
=== (Identical)
{% 22 === '22' %} >> False
!= (Not equal)
{% 22 != '22' %} >> True
!== (Not identical)
{% 22 !== '22' %} >> True
The difference between equal (==) and identical (===) is that '==' should be used to check if the values of the two operands are equal or not. On the other hand, '===' checks the values as well as the type of operands.
< (Less than)
{% 5 < 8 %} >> True
> (Greater than)
{% 6 > 6 %} >> False
<= (Less than or equal to)
{% 4 <= 7 %} >> True
>= (Greater than or equal to)
{% 6 >= 6 %} >> True
Matches (Regex match)
{% {dataField} matches "/bar/" ? "yes" : "no" %}
Array
In (Contain)
{% 5 in [5,1,3] %} >> True
Not in (Does not contain)
{% 7 not in [2,8,9] %} >> True
String
~ (Concatenation)
{% 'Hello' ~ 'World!' %} >> HelloWorld!
(Ternary Operators)
?:
{% {financial_status} === 'paid' ? 'All paid' : 'Waiting for payment' %}
{% {financial_status} === 'paid' ? uppercase({financial_status}) : 'Waiting for payment' %}
Updated on: 10/06/2022
Thank you!