- Getting Started
- Administration Guide
- User Guide
- Developer Guide
Operators
The analytical expressions make use of operators for creating expressions to compare values, perform arithmetic calculations, or also work with strings.
Types of Operators
There are four types of calculation operators available: arithmetic, comparison, text concatenation, and logical.
Arithmetic Operators
Use the following arithmetic operators to perform basic mathematical operations such as addition, subtraction, or multiplication; combine numbers; or produce numeric results.
Operator | Description | Example |
---|---|---|
+ (plus sign) | Addition | 1 + 1 |
– (minus sign) | Subtraction | 6 – 4 – 1 |
* (asterisk) | Multiplication | 5 * 4 |
/ (forward slash) | Division | 3 / 3 |
^ (caret) | Exponentiation | 81 ^ 4 |
Note:
1. The plus sign (+) and the minus sign (-) can both serve as a binary operator and as a unary operator.
2. The forward slash is an unsafe division. Please use the divide function for using a safe division. For more information, see Math functions article.
Comparison Operators
You can use the following operators to compare two values. While comparing two values by using the following operators, the result is always a logical value, either TRUE or FALSE.
Operator | Description | Example |
---|---|---|
= | Equal to | [Region] = "China" |
== | Strict equal to | [Region] == "China" |
> | Greater than | [SaleAmount] > 10000 |
< | Less than | [SaleAmount] < 10000 |
>= | Greater than or equal to | [Amount] >= 2000 |
<= | Less than or equal to | [Amount] <= 10 |
<> | Not equal to | [Region] <> "USA" |
Note: The settings of the database itself specify whether the "=" operator is case-sensitive or not.
Text concatenation operator
Use the ampersand (&) to join or concatenate two or more text strings for creating a single piece of text.
Operator | Description | Example |
---|---|---|
& (ampersand) | Connects, or concatenates, two values to produce one continuous text value | [City] & ", " & [Street] |
Logical operators
Use logical operators (&&) and (||) to combine expressions for creating a single result.
Note: The "IN" operator mentioned above is a function, not a binary operator.
Operator Precedence
If you combine multiple operators within a single formula, the operations are ordered according to the following table. In case the operators have equal precedence values, they are ordered from left to right. For example, if an expression contains both a multiplication and a division operator, they are evaluated in the order in which they appear in the expression, that is, from left to right.
Operator | Description |
---|---|
^ | Exponentiation |
– | Sign (as in –1) |
* and / | Multiplication and division |
+ and – | Addition and subtraction |
& | Connects two strings of text (concatenation) |
=,==,<,>,<=,>=,<>,IN | Comparison |
NOT | NOT (unary operator) |