How to Add an Expression Template or Expression on Variable

Expression syntax elements

An expression template or expression on variable contains one or more of the following elements:

To avoid unexpected results, the expression elements used must respect the output type. For example if you were creating an expression on a register variable, it must only contain elements that combined together generate a numerical result.

How to add an expression template or expression on variable

The process to add either an Expression Template or Expression on Variable is very similar.

  1. Select the Expressions folder in the Application Explorer configuration tree and, from the task list, select Add an expression template or Add an expression on a variable as appropriate. A dialog to configure a new expression will open.
  2. Using the General tab configure the expression general properties. ClosedShow picture


    1. Enter a name for the expression in the Name field. The name is used when referencing the expression in an animation.
    2. Enter a description of the expression. The description appears in the contents pane when the Expressions folder is selected. The description is optional.
    3. If creating an Expression on Variable.
      • Enter a branch in the Branch field. The branch is prefixed to all variables used in the expression including the result. The ellipsis button adjacent to the Branch field opens the Branch Selector dialog. The branch is optional.
      • Select the Result variable in which the result of the expression will be placed. The result variable does not need the control property set. The ellipsis button adjacent to the Result field displays the Variable Selector dialog
    4. If the project has a multi-station configuration select the Server list name. The expression will only be computed on stations that appear in that list.
    5. Select an optional Enabling bit to enable or disable the expression. The bit must be set to 1 to enable the expression calculation.
    6. Tick the Enable box. It must be ticked for the expression calculation to be enabled.
  3. Select the Expression tab and enter the expression. See the topic Expression functions and operators. You can select any variables, which are to be included in the expression, using the Variable Selector tool above the expression field. ClosedShow picture


  4. Click OK to confirm the configuration and close the dialog.

Expressions on variables and expression templates are limited to 32 000 characters and 40 variables.

An expression on variable or an expression template is evaluated each time any of the variables within it changes. This makes expressions preferable to calculating a value in a script where you would have to arrange for it to be executed on event each time any value changes.