Variable Functions

When a calculated attribute becomes too large to easily modify, you can use one or more variables to separate out parts of it, making it easier to test and manage. Variables allow you to calculate portions of the overall calculation individually, so that it becomes easier to read and maintain. Refer to the use cases below.

A variable is declared within a calculated attribute using a label to identify the purpose, the text ':=', and then the necessary function(s), for example: [label] := [function]

Multiple variable declarations are added before a function call as a comma-separated list in curly brackets {}. The scope of the variables declared are only available inside the List function parameters that follow. (For more information, refer to the List Functions documentation here.) Variables can be reassigned to another value by normal expression 'var:=expr'. This expression evaluates to the value of 'expr' by assigning the value to variable 'var'.

Special Variable Functions

In addition to variables you create as described above, the following special variable functions are available for use within all ITERATE and FILTER function expressions: index, item, and size. These special variable functions can be typed into the Function Editor, or found by clicking the Insert Template button and navigating to Default Templates > All Functions > Special Variables.

Use Cases

For examples of these functions, refer to Variable Examples here.

For a scenario using the INDEX function, refer to Including Parent Info on Child Scenario here.

For a scenario using variables, refer to Overrides Scenario here.

For a scenario using the INDEX and ITEM functions, refer to Total Cost of Materials Scenario here.