An operator is a sign or symbol that specifies the type of calculation to perform within an expression. There are mathematical, comparison and logical operators. WEBcnx Expressions support a variety of operators, including arithmetic operators such as +, -, multiply (*), and divide (/), in addition to comparison operators for comparing values and logical operators for determining true or false values. This article provides details about using these operators.
Arithmetic Operators
You use the arithmetic operators to calculate a value from two or more numbers or to change the sign of a number from positive to negative or vice versa.
Operator | Purpose | Example |
---|---|---|
+ | Sum two numbers. | [Subtotal] + [SalesTax] |
- | Find the difference between two numbers or indicate the negative value of a number. | [Price] - [Discount] |
* | Multiply two numbers. | [Quantity] * [Price] |
/ | Divide the first number by the second number. | [Total] / [ItemCount] |
Comparison Operators
You use the arithmetic operators to calculate a value from two or more numbers or to change the sign of a number from positive to negative or vice versa.
Operator | Purpose | Example |
---|---|---|
< | Returns True if the first value is less than the second value. | Value1 < Value2 |
<= | Returns True if the first value is less than or equal to the second value. | Value1 <= Value2 |
> | Returns True if the first value is greater than the second value. | Value1 > Value2 |
>= | Returns True if the first value is greater than or equal to the second value. | Value1 >= Value2 |
= | Returns True if the first value is equal to the second value. | Value1 = Value2 |
!= | Returns True if the first value is not equal to the second value. | Value1 != Value2 |
NOTE: In all cases, if either the first value or the second value is null, the result is then also null. Because null represents an unknown value, the result of any comparison with a null value is also unknown.
Logical Operators
You use the logical operators to combine two Boolean values and return a true, false, or null result. Logical operators are also referred to as Boolean operators.
Operator | Purpose | Example |
---|---|---|
And | Returns True when Expr1 and Expr2 are true. | Expr1 And Expr2 |
Or | Returns True when either Expr1 or Expr2 is true. | Expr1 Or Expr2 |
Not | Returns True when Expr is not true. | Not Expr |