Formula parsing rules
- Last UpdatedFeb 21, 2025
- 2 minute read
Formulas must adhere to the following rules with respect to the type of data being entered.
Text
-
All text values used in expressions must be enclosed within quotation marks.
-
Single or double quotes can be used, though a text value must start and end with the same type.
Numbers
-
Numbers can be entered normally (e.g. 0.01234) or in scientific notation (e.g. 1.234e-2).
Dates
-
All date values must be enclosed in quotes in the expression (e.g. "1/1/2005 8:53AM").
Variables and Tags
-
Variable names can be entered directly into the expression, e.g. @GETVALUE(A,&NULL) + 10).
-
If the variable name has a space or special characters in it (possible when using Tags), it must be enclosed in square brackets (e.g. [Down Time] * Cost). This is done automatically when selecting from the Formula Component Browser.
-
Brackets are optional for names without spaces or special characters.
-
The parser will check to make sure a variable exists with the name provided. The formula will not validate if a named variable is not found.
-
Variable/Tag names are case insensitive in calculation expressions.
-
Tag names containing special characters or spaces must be enclosed within brackets.
-
Variable names containing the ampersand (&) must be enclosed within brackets, since ampersands precede the calculation engine’s Keywords.
-
Variable names containing the asperand (@) must be enclosed within brackets, since asperands precede the calculation engine’s Functions.
Parentheses
-
Parentheses can be used to clarify the expression, or to change the order of operations (see below).
-
The parser will trap for unmatched parentheses (e.g. an open parenthesis without an accompanying close parenthesis). Formulas containing unmatched parentheses will not validate.
Operators
-
Operators are entered without any special preparation, e.g. 10 + 20, @GETVALUE([A],&NULL)+10
Functions
-
Functions can be nested if of the appropriate type, e.g. @GetValue(@ParentNode(@CurrentNode))
Order of Operations
-
An operator/function defines the number and types of parameters it can accept; .e.g. @SIN ultimately requires exactly one numeric value to be passed in. As unlikely an equation as follows, "@SIN((@Getvalue(Tag1,&NULL))/(@Getvalue(Tag2,&NULL)))" would satisfy this requirement due to the order of operations handling the mathematics within the parentheses before invoking the sine function.
-
If an operator requires multiple parameters, each parameter must be separated by a comma.
Operators are normally processed in the following order:
-
Unary: The text "-3" is interpreted as negative 3 rather than subtraction
-
Functions: Most of the operators that begin with "@"
-
Logical: AND, OR, <= …
-
Power: Raising a number to the power of something else (e.g. 3^2 = 9)
-
Multiplication: Includes division
-
Modulus: Taking the integer remainder of a division (e.g. 5%2 = 1)
-
Arithmetic: Addition or subtraction
Note: As noted earlier, parentheses can be used to change the order: (3+4) * 5 would evaluate the "3+4" part first even though multiplication has a higher priority.