LISTSERV Maestro 11.0-20 Help Table Of Contents

Calculation Formulas

Back to Calculation Formulas Overview


Operators

Operators usually work on two operands or sometimes on a single operand. Operands may be any valid expressions. Some operators may also require their operand expressions to be of a certain type.


Operators for Number Operands

If both operands are of type Number, then you can use the following operators:

OperatorResult TypeResult
+AdditionNumberThe sum of both operands.
-Subtraction (binary operator with two operands)NumberThe difference of both operands.
-Negative Value (unary operator with one operand)NumberThe negative value of the operand.
This operator has only a single operand, at the right side of the operator.
*MultiplicationNumberThe product of both operands.
/Integer-DivisionNumberThe integer-quotient of both operands.
%ModuloNumberThe remainder of integer-division of both operands.
=Equals-ComparisonBoolean"True" if the two operands are the same number, "false" otherwise.
<>Not-Equals-ComparisonBoolean"True" if the two operands are not the same number, "false" otherwise.
This operator can als be written as "^=".
<Less-Than-ComparisonBoolean"True" if the first operand number is less than the second operand number.
<=Less-Or-Equal-ComparisonBoolean"True" if the first operand number is less than or equal to the second operand number.
>Greater-Than-ComparisonBoolean"True" if the first operand number is greater than the second operand number.
>=Greater-Or-Equal-ComparisonBoolean"True" if the first operand number is greater than or equal to the second operand number.

Note: In LISTSERV Maestro, the division is strictly an integer division; therefore, any decimal places in the result are discarded (not rounded off, but simply ignored!).


Operators for Text Operands

If one operand is of type Text and the other is either also of type Text or is of type Number, then you can use the following operators:

OperatorResult TypeResult
+ConcatenationTextA new text string that is created by appending the second operand text to the first operand text.
=Equals-ComparisonBoolean"True" if the two operands are the same text, "false" otherwise.
<>Not-Equals-ComparisonBoolean"True" if the two operands are not the same text, "false" otherwise.
This operator can als be written as "^=".
<Less-Than-ComparisonBoolean"True" if the first operand text is less than the second operand text.
<=Less-Or-Equal-ComparisonBoolean"True" if the first operand text is less than or equal to the second operand text.
>Greater-Than-ComparisonBoolean"True" if the first operand text is greater than the second operand text.
>=Greater-Or-Equal-ComparisonBoolean"True" if the first operand text is greater than or equal to the second operand text.

If only one operand is of type Text and the other is of type Number, then this number operand will automatically be converted into a text before the operator is applied.

Note: Text Comparisons are case sensitive, so "this" is not equal to "THIS". Also, the "less-than" and "greater-than" Comparisons are based on the character ordering of the Unicode standard, which makes a difference between lowercase and uppercase characters. For example, even though "ABC" < "XYZ" is true, "abc" < "XYZ" is not true because in Unicode all uppercase characters come before all lowercase characters. If you need to perform a case insensitive Comparison, you should first convert both operands to the same case (either lowercase or uppercase) using the "ToLower(arg)" or "ToUpper(arg)" functions.


Operators for Boolean Operands

If both operands are of type Boolean, then you can use the following operators:

OperatorResult TypeResult
andBoolean "And"Boolean"True" if both operands are "true", "false" otherwise.
orBoolean "Or"Boolean"True" if one or both operands are "true", "false" otherwise.
notBoolean "Negation"Boolean"True" if the operand is "false", "false" otherwise.
This operator has only a single operand, at the right side of the operator.
=Equals-ComparisonBoolean"True" if the two operands have the same boolean value, "false" otherwise.
<>Not-Equals-ComparisonBoolean"True" if the two operands operands have different boolean values, "false" otherwise.
This operator can als be written as "^=".
 

Operators for Set Operands

If one of the operands if of type Set, and the other operand is not of type Boolean, then you can use the following operators:

OperatorResult TypeResult
+UnionSetA set that contains all elements from both operand sets.
-Relative CompletementSetA set that contains all elements from the first operand set that are not in the second operand set.
#IntersectionSetA set that contains all elements that are present in both operand sets.
=Equals-ComparisonBoolean"True" if the two operands are the same set, "false" otherwise.
<>Not-Equals-ComparisonBoolean"True" if the two operands are not the same set, "false" otherwise.
This operator can als be written as "^=".
<Proper-Subset-ComparisonBoolean"True" if the first operand is a proper (or strict) subset of the second operand set (all values from the first set are also contained in the second set, and the second set has additional other values).
<=Subset-ComparisonBoolean"True" if the first operand is a subset of the second operand set (all values from the first set are also contained in the second set, where the two sets may also be the same).
>Proper-Superset-ComparisonBoolean"True" if the first operand is a proper (or strict) superset of the second operand set (all values from the second set are also contained in the first set, and the first set has additional other values).
>=Superset-ComparisonBoolean"True" if the first operand is a superset of the second operand set (all values from the second set are also contained in the first set, where the two sets may also be the same)

If only one operand is of type Set and the other is of type Text or Number, or if both operands are sets, but one is of type Number Set and the other of type Text Set, then the following conversion will automatically be performed before the operator is applied:

  • One operand is of type Text Set: Depending on the type of the other operand, one of the following conversions may be performed:
    • Number: The number operand is converted into a text set by creating a new set with a text representation of the number as the single element of the set. After this, both operands are of type Text Set and the set operator can be applied to them.
    • Text: The text operand is converted into a text set by creating a new set with the text as the single element of the set. After this, both operands are of type Text Set and the set operator can be applied to them.
    • Number Set: The number set operand is converted into a text set by creating a new set that contains text representations of all numbers in the number set. After this, both operands are of type Text Set and the set operator can be applied to them.
    • Text Set: No conversion necessary. Both operands are of type Text Set anyway and the set operator can be applied to them.

  • One operand is of type Number Set: If the other operand is of type Text Set, then we are dealing with a case that was already described above. If the other operand is not of type Text Set, then depending on the type of the other operand, one of the following conversions may be performed:
    • Number: The number operand is converted into a number set by creating a new set with the number as the single element of the set. After this, both operands are of type Number Set and the set operator can be applied to them.
    • Text: The text operand is converted into a text set by creating a new set with the text as the single element of the set. In addition, the Number Set argument itself is also converted into a text set by creating a new set that contains text representations of all numbers in the number set. After this, both operands are of type Text Set and the set operator can be applied to them.
    • Number Set: No conversion necessary. Both operands are of type Number Set anyway and the set operator can be applied to them.


Operator Precedence and Parenthesis

Formulas are processed by Maestro following the usual mathematical conventions:

Operators with higher precedence are processed first. If several operators with the same precedence level are encountered, they are processed from left to right. Parenthesis can be set freely to influence precedence where inner parenthesis will be processed before outer parenthesis.

Operator precedence is defined as follows (from highest to lowest, operators on the same row have the same precedence level):

not-(for unary "minus", i.e. "negative value")
*/%#
+-(for binary "minus", i.e. "subtraction")
=<><<=>>=
and
or
Examples:
15 + 3 * 4 Result: 27
8 * (7 - 3) Result: 32
17 * 22 / 2 % 5 Result: 2
17 * (22 / 2 % 5) Result: 17
17 * (22 / (2 % 5)) Result: 187

© 2002-2023 L-Soft Sweden AB. All rights reserved.