Syntax
Operators
Section titled “Operators”| Syntax | Meaning | Example |
|---|---|---|
+ | Addition | 100 + 20 |
- | Subtraction | 100 - 20 |
* | Multiplication | 100 * 0.05 |
/ | Division | 100 / 4 |
(...) | Grouping | (100 + 20) * 0.05 |
Leading - or + | Sign | -100 |
Multiplication and division run before addition and subtraction. Operators of equal precedence run from left to right, so 100 / 5 * 2 is 40. Spaces and line breaks may separate tokens.
Dividing by zero with / raises an error. Use SAFE_DIV to return a missing value instead.
Numbers
Section titled “Numbers”| Form | Example | Value |
|---|---|---|
| Decimal | 1250.50 | 1250.5 |
| Leading point | .05 | 0.05 |
| Scientific notation | 1.25e3 | 1250 |
Use a period as the decimal separator. Do not use thousands separators, currency symbols, or percent signs.
Strings
Section titled “Strings”Strings use single or double quotes: 'example_key' or "example_key".
Within a string argument, + joins strings. Numbers are not converted to text automatically.
| Escape | Character |
|---|---|
\n | Newline |
\r | Carriage return |
\t | Tab |
\\ | Backslash |
\' or \" | Quote |
Booleans
Section titled “Booleans”Boolean arguments accept true, false, a Boolean reference such as a Boolean argument, or a Boolean-returning function. They may be parenthesized.
IIF(Args.UseGrowth, this.PrevY * 1.05, this.PrevY)References
Section titled “References”A reference is an entity followed by a dot-separated property path. Each identifier in the path starts with a letter or underscore and continues with letters, digits, or underscores. Display labels that contain spaces cannot be used as references.
| Reference | Type | Value |
|---|---|---|
this.PrevY | Decimal | The current line’s value in the previous year. Available when the expression is evaluated for a line. |
Cur.<line path> | Decimal | A financial line’s value in the year being calculated. |
PrevY.<line path> | Decimal | A financial line’s value in the previous year. |
Cur.Year | Integer | The year being calculated. |
PrevY.Year | Integer | The previous year. |
Args.<key> | Argument’s type | A scalar argument’s value, or a time-series argument’s value for the year being calculated. |
AssumptionCurve.<key> | Decimal | The curve’s value for the year being calculated, whatever year is passed to a surrounding function. |
Def.<line path> | String | The key of a financial line, for use as the key argument of a lookup function. |
Replace <line path> with the complete path from the editor, including any segment or statement components, for example Cur.BalanceSheet.Assets. Do not type the angle brackets. Segment-definition contexts may expose further line keys as strings.
Function Calls
Section titled “Function Calls”SAFE_DIV(100, 4)ROUND(SAFE_DIV(100, 3), 2)Arguments are separated by commas, and calls can be nested. Each call must supply exactly the number of arguments in the function’s signature.
Function names may be written unqualified. The qualified form uses the Engine entity, as in Engine.SAFE_DIV(100, 4). Variable references always need their entity.
All arguments are evaluated before the function runs, including both branches of IIF and both inputs of COALESCE.
See Functions for the full list.
| Type | Used for |
|---|---|
| Decimal | Financial values, rates, and the result of the main expression |
| Integer | Years, period numbers, offsets, windows, and rounding precision |
| String | Financial line keys and text arguments |
| Boolean | Conditions in IIF, IIF_INT, and IIF_STR |
The main expression must produce a decimal.
Integer and decimal references are not converted into each other. An integer year such as Cur.Year can fill the year argument of Val, but cannot be added to a decimal financial value. Literals such as 2 take the type that their position expects. Integer arithmetic supports the same four operators, and integer division truncates toward zero.
Missing Values
Section titled “Missing Values”A recognized reference may have no value for the requested period. A missing value is distinct from zero and generally propagates through arithmetic. COALESCE, NULLIF, and SAFE_DIV handle missing values explicitly.
Unsupported Syntax
Section titled “Unsupported Syntax”The following are not supported:
- Comparison operators:
>,<,==,!= - Logical operators:
and,or,! - Exponentiation
^and remainder% - Ternary expressions, assignments, and loops
- Comments
- Array literals
- A literal
null
Common Errors
Section titled “Common Errors”| Error | What to check |
|---|---|
| Unknown variable or property | The full registered reference, including line path, argument key, curve key, and capitalization. |
| Wrong type | Decimals in financial arithmetic, integers for years and offsets, strings for keys, and Booleans for conditions. |
| Wrong argument count | The function signature, with arguments separated by commas. |
| Unexpected character | Unsupported symbols such as %, >, ^, currency symbols, or thousands separators. |
| Division by zero | Use SAFE_DIV if a zero denominator should produce a missing value. |
| Error in an unused conditional branch | Both branches are evaluated, so each must be valid on its own. |
| Missing result | The requested period, the availability of previous values, and the function’s missing-value rules. |
