Skip to main content
Version: 8.1

Expression Bindings in Perspective

Inductive University

Expression Binding

Watch the video

Binding Properties to the Outcome of an Expression​

An expression binding is one of the most powerful kinds of property bindings. It uses a simple expression language to calculate a value. This expression can involve lots of dynamic data, such as other properties, tag values, results of Python scripts, queries, and so on. Any time information needs to be massaged, manipulated, extracted, combined, split, and so on - think expressions!

Event Based and Polling​

How an expression updates depends on what is being done in the expression. Expression bindings will always update immediately when the window they are in is opened. When they update again depends on if they are driven by events or polling. Typically, expressions are driven by events. If the expression was adding multiple values together, then when one of those values changed the expression would update, regardless of whether those values came from other properties or tags. However, the expression function has some unique functions that can update at a set rate such as the now() function. When these functions are used within the expression, the expression binding will update based on the specified polling rate.

Using Expression Bindings​

The expression language has lots of tools available that help calculate a specific value such as built in expression functions, multiple operators, and the ability to reference tags. While all of these can be manually typed into the expression, the expression binding window makes it easy to reference these options.

To the right of the Expression Binding window, there are four buttons which can be used to reference specific objects or functions easily.

IconFunctionDescription
OperatorsPlaces the operator into the expression at the cursor. Mostly used as a reference to what operators are available for use.
FunctionsPlaces the function into the expression at the cursor. Can be used as a reference for what functions are available, as well as the parameters the function is expecting.
TagsPlaces a Tag reference into the expression at the cursor, pulling in that Tag's value into the expression at the time of evaluation.
PropertiesPlaces a property reference into the expression at the cursor, pulling in that property's value into the expression at the time of evaluation.

Example 1​

In this first example we'll use an Expression binding to combine and display the value of two Tags.

  1. Create a new view and place two LED components on it.

  2. Select the first LED component and click on the Binding icon for the value property.

  3. Select Expression the binding type.

  4. In the Configure Expression Binding section, click on the Tag icon.

  5. Scroll down to the Tag you want to use (Ramp0 in the example) and click OK.

  6. Next click the Operators icon. Select Mathematical, and then choose the Addition option.

  7. Click the Tag icon again and select the second Tag. Click OK.

    Now when this Expression is run, the value of this Tag will be added to the first Tag. Note that a preview of the Expression binding value is shown on the lower left.

Example 2​

Let's continue with the same view we set up in Example 1.

  1. Select the second LED component and click on the Binding icon for the value property.

  2. Select Expression the binding type.

  3. In the Configure Expression Binding section, click on the Functions icon. Scroll down to the Math functions and then select the abs (number) function.

  4. Next click the Tag icon and select the Memory Tag. Click OK.

  5. Next close the function with a closed parenthesis ). Note that a preview of the Expression binding value is shown on the lower left. Click OK.

  6. The value is now displayed in the LED component.