Skip to main content

Operators

Operators are used to perform operations on variables and values.

There are four operator types:

Assignment operators

There is a single operator for assigning values to variables.

Operator

Syntax

Example

ASSIGNMENT

=

x = y

Use this operator to create script variables. For example:

[[

Q1data = filterRows(WholeTable, Quarter, q -> q == 'Q1')

allQ1Sales = columnsInRegion(Q1data, Sales)

currencyFormat(totalVal(allQ1Sales))

]]

Arithmetic operators

Arithmetic operators perform arithmetic with values or variables.

Assume that x = 10 and y = 3.

Operator

Syntax

Example

Result

ADDITION

+

x + y

13

SUBTRACTION

-

x - y

7

MULTIPLICATION

*

x * y

30

DIVISION

/

x / y

3.33

EXPONENTIATION

^

x ^ y

1000

MODULUS (REMAINDER)

%

x % y

1

Note

There are equivalent ATL functions for the first five operators above — see sum, diff, product, div, and power. For example, sum(x,y) performs the same arithmetic as x + y.

Comparison operators

Comparison operators are used in logical statements to compare values or variables.

Assume that x = 10 and y = 10.

Operator

Syntax

Example

Result

EQUAL TO

==

x == y

true

NOT EQUAL TO

!=

x != y

false

GREATER THAN

>

x > y

false

GREATER THAN OR EQUAL TO

>=

x >= y

true

LESS THAN

<

x < y

false

LESS THAN OR EQUAL TO

<=

x <= y

true

Logical operators

Logical operators are used to combine or negate individual conditions.

Assume that x = 20 and y = 30.

Operator

Syntax

Example

Result

AND

&&

x > 10 && y > 50

false

OR

||

x > 10 || y > 50

true

NEGATION

!

!(x > 10)

false