Operators
For more information: Manage import scenarios (SM206025), Manage export scenarios (SM207025).
To add operators to the formula, you can enter them directly in the Formula text area of the dialog box or select them from the list of formula components available within the dialog box. (Select an operator type to view the list of operators of the type, and then select an operator.) To specify the operands for operators, you can type them in the Formula text area or select them from the list of external or internal fields provided within the Formula editor dialog box.
This article describes and provides examples of the operators you can use in formulas, broken down by operator type.
Overview of operators
There are two types of operators: unary and binary. Unary operators are applicable to only one operand, while binary operators require two operands.
In general, expressions are evaluated from left to right with the following order of precedence:
- Logical operators:
Not,And,Or - Comparison operators: =, <>,, <=, >=
- Arithmetic operators: -, *, /,
Mod, +, -
Arithmetic operators
Arithmetic operators, which are listed below, take numerical values as their operands and return a single numerical value.
- +
Adds the two operands and returns the result. If at least one operand is a string, this operator returns a concatenated string.
Example:
=[Amount]+[VAT amount]In this example, the
[Amount]and[VAT amount]values are used as operands.- -
Subtracts the second operand from the first.
Example:
=[Amount]-[Cash discount]In this example, the
[Amount]and[Cash discount]values act as operands.- *
Multiplies the two operands.
Example:
=[Chargeable amount]*0.03In this example, the
[Chargeable Amount]value and the number 0.03 serve as operands.- /
Yields the quotient of the operands, which is the first operand divided by the second.
Example:
=[Amount]/[Rate reciprocal]In this example, the
[Amount]and[Rate reciprocal]values are the first and second operands.- Mod (Modulus)
Divides the first integer operand by the second integer operand and returns the remainder, rounded to the nearest integer.
Example:
=[Volume] Mod [Conversion factor]In this example, the
[Volume]and[Conversion factor]values are used as operands.
Logical operators
Logical operators evaluate one or two Boolean expressions and return a Boolean result
(True or False).
Because these operators evaluate only Boolean
expressions, you must use elements whose only values are True and
False (typically check boxes and radio buttons).
The logical operators
are listed below.
- And
Performs logical conjunction on two Boolean expressions: returns
Trueif and only if both expressions evaluate toTrue; in other cases, returnsFalse.Example:
=[Hold] And [Validate control totals on entry]In this example, the
[Hold]and[Validate control totals on entry]check boxes are used as operands.- Or
Performs logical disjunction on two Boolean expressions: returns
Trueif at least one expression evaluates toTrue; returnsFalseif neither expression evaluates to True.Example:
=[Hold] Or [Validate control totals on entry]In this example, the[Hold]and[Validate control totals on entry]check boxes act as operands.- Not
Performs logical negation on a Boolean expression: returns
Trueif and only if the operand isFalse. Logical negation is an unary operator.Example:
=Not [Hold documents on entry]In this example, the
[Hold documents on entry]check box is used as the single operand.
Comparison operators
Comparison operators compare two expressions and return a Boolean value
(True or False) that represents the result of the comparison.
This group of operators includes the following operators.
- =
Returns
Trueif operands are equal.Example:
=([Credit total] = [Control total])In this example, the
[Credit total]and[Control total]values are used as operands.- <>
Returns
Trueif operands are not equal.Example:
=([Credit total] <> [Debit total])In this example, the
[Credit total]and[Debit total]values act as operands.- <
Returns
Trueif the first operand is less than the second one.Example:
=([DocDate] < [DueDate])In this example, the
[DocDate]and[DueDate]values act as operands.- >
Returns
Trueif the first operand is greater than the second one.Example:
=([CrLmt] > 1000])In this example, the
[CrLmt]value is used as the first operand, and the number 1000 acts as the second operand.- <=
Returns
Trueif the first operand is less than or equal to the second operand.Example:
=(([DueDate]-[CashDiscountDate]) <= [LeadTime])In this example,
[DueDate] - [CashDiscountDate]is the first operand, and the[LeadTime]value is used as the second operand.- >=
Returns
Trueif the first operand is greater than or equal to the second operand.Example:
=([Balance] => [Amount])In this example, the
[Balance]and[Amount]values are used as operands.
Other operators
This miscellaneous group of operators includes the following operators and constants.
- In
An operator that returns
Trueif the second operand (a string) contains the first operand (which is also a string).Example:
=('Inc.' In [Supplier name])In this example, the
[Supplier name]value is used as an operand, and the formula returnsTrueif the name of the supplier contains Inc.- True
A binary constant used as an operand in logical expressions.
Example:
=True- False
A binary constant used as an operand in logical expressions.
Example:
=False- Null
A special value used as an operand in logical expressions; designates an undefined value.
Example:
=Null
Parent topic:
Related reference
Formula editor dialog box Manage import scenarios (SM206025) Manage export scenarios (SM207025)