Operators


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.

Table of Contents

Unary Operators

Operate on a single operand.

!, not()

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

Exponential Operators

**

Exponentiation 

2 ** 3

returns 8 

Multiplicative Operators

*

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  

Additive Operators

+

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

Equality and Inequality Operators

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”.  

Comparison Operators

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 Operators

and, &&

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. 

or, ||

Logical OR

(1 == 1) || false

Evaluates to true