Table of Contents

Template Variables

Variables are reusable named expressions within a BOM Calculation Template. They simplify complex formulas by allowing intermediate calculations to be defined once and referenced multiple times across template lines and other expressions.

What are variables

A variable consists of a name and an expression. The expression can reference properties, other variables, matrices, and mathematical functions. Once defined, the variable name can be used directly in any template line expression or header dimension expression.

For example, instead of repeating PROP["Length"] - 2 * PROP["Wall Thickness"] in every line where the inside length is needed, a variable LIM (Length Inside Measure) can represent this calculation.

How to create variables

  1. Open the BOM Calculation Template Card.
  2. Choose the Variables action to open the variable list.
  3. Enter a Name for the variable.
  4. Enter the Expression that defines the variable's calculation. Use the assist-edit button (AssistEdit) to open the Expression Editor.
  5. Repeat for each variable needed.
Field Description
Name The name of the variable. Used to reference the variable in other expressions. Must follow naming rules (letters, digits, and underscores; must start with a letter or underscore).
Expression The formula that calculates the variable's value. Can contain property references, other variables, matrix lookups, and mathematical operations.
Note

Variable names cannot use reserved system variable names (such as mathematical function names). The system validates the name during creation and shows an error if a reserved name is used.

Naming conventions

Use short, descriptive names that indicate what the variable represents. Common conventions in packaging include:

Variable Meaning Example expression
LIM Length Inside Measure PROP["Length"] - 2 * PROP["WallThickness"]
WIM Width Inside Measure PROP["Width"] - 2 * PROP["WallThickness"]
HIM Height Inside Measure PROP["Height"] - 2 * PROP["WallThickness"]
LOM Length Outside Measure PROP["Length"] + 2 * PROP["WallThickness"]
WOM Width Outside Measure PROP["Width"] + 2 * PROP["WallThickness"]
HOM Height Outside Measure PROP["Height"] + 2 * PROP["WallThickness"]
BoardArea Total board surface area (LIM + WIM) * 2 * HIM
Volume Inner volume LIM * WIM * HIM

How variables reference properties and other variables

Variables can reference:

  • Properties using the syntax PROP["PropertyCode"]
  • Other variables by their name directly (e.g., LIM, WIM)
  • Matrices using the syntax MAT["MatrixCode", FilterValue1, FilterValue2]
  • Mathematical functions such as MAX(), MIN(), IIF(), ROUND(), and others

Example: Simple variable

LIM = PROP["Length"] - 2 * PROP["WallThickness"]

This calculates the inside length by subtracting twice the wall thickness from the total length.

Example: Variable referencing other variables

BoardArea = (LIM + WIM) * 2 * HIM

This calculates the total board area using the previously defined LIM, WIM, and HIM variables.

Example: Conditional variable

LidFactor = IIF(PROP["HasLid"] == 1, 1, 0)

This returns 1 if the boolean property "HasLid" is true, and 0 otherwise.

Using variables in template lines

Variables are used in template line expression fields just like properties. Enter the variable name directly in the expression:

Units Calculation Expr: LIM * WIM / 1000

This calculates the number of units based on the inside length and width variables.

Tip

Use the Check Expressions action on the template card to validate all expressions and detect references to undefined properties or variables.

Important rules

  • Every variable must have both a name and an expression. Empty entries are not allowed and will trigger a warning when closing the variable list.
  • Renaming or deleting a variable that is referenced in template lines or other variables is blocked by the system.
  • Variables are evaluated in dependency order, not in the order they appear in the list.

See Also