This article lists mathematical and logical operators that can be used in OpenGround expressions.
Please see our Functions Guide for additional information about other functions that can be used when writing expressions.
Operate on a single operand.
Logical NOT that can be applied to a Boolean (true/false) operand.
!(true)
returns false
not(true)
returns false
Negation of a numeric operand
-5
Exponentiation
2 ** 3
returns 8
Multiplication
2 * 3
returns 6
2 * '3'
returns 6
'2' * 3
returns 6
'2' * '3'
returns 6 in Template Studio
not supported in Model Calculations
Division
6 / 2
returns 3
99 / 0
returns null
6 / '2'
returns 3
'6' / 2
returns 3
'6' / '2'
returns 3 in Template Studio
not supported in Model Calculations
Modulus. The modulus operator calculates the remainder when one number is divided by another.
10 % 3
returns 1
Addition or string concatenation, depending on the data type of the operands
2 + 1
returns 3
'abc' + 'de
returns 'abcde'
Subtraction of numeric operands. If a string operand is provided, and it can be parsed as a numeric value, that numeric value will be used.
5 – 2
returns 3
5 – '2'
returns 3
'5' – 2
returns 3
'5' – '2'
returns 3 in Template Studio
not supported in Model Calculations
These operators compare two values to check equality or inequality and return a Boolean (true/false) result:
Equal to
5 = 5
returns true
5 = '5'
returns true (Strings can be compared to numbers if the values can be parsed to numeric values.)
5 = '5a'
returns false
[Group.BooleanHeader] = 'true'
returns true when the Boolean header is true
[Group.BooleanHeader] = 1
returns true when the Boolean header is true
'abc' = 'abc'
returns true
'abc' = 'Abc'
returns false
Not equal to
“Not equal to” supports comparisons between the same data types as “Equal to”.
These operators compare two values to determine their relative order and return a Boolean (true/false) result. When one operand is numeric and the other operand is a string (and a numeric value can be parsed), the comparison between the numeric values will be returned. When both operands are strings, a string comparison is made. Lowercase letters will be “less than” uppercase letters.
Less than
5 < 8
returns true
'abc' < 'Abc'
returns true
'5' < '5'
returns false
25/04/2021 < 26/04/2021
returns true
Less than or equal to
5 <= '8'
returns true
Greater than
'3' > 6
returns false
Greater than or equal to
6 >= 3
returns true
Logical AND
true or false and true
Evaluates to true
Note: The and operator has higher priority than the or operator. Hence, in the example above, false and true is evaluated first.
Logical OR
(1 == 1) || false
Evaluates to true