Expression evaluator

Calculate the result of an expression with integers, decimals, numeric variables, string variables for string comparisons, arithmetic and Boolean operators, or a set of functions.

Input

Properties
Property
Description
Expression
The expression to be calculated.
To add variables to the expression, enter consecutive numbers or unique strings starting with
#
in braces
{}
. For example, enter
{0}
and then enter
{1}
later in the expression. Fill
{#}
Dynamic link
fields corresponding with each variable.
The expression can contain an unlimited number of correctly opened and closed braces
{}
. If the expression does not follow the correct syntax, the converter does not perform the calculation.
Dynamic link mode
Read
Read direction for dynamic link icon
Read from the source node to the parent.
Default for dynamic links defined in NetLogics.
Write
Write direction for dynamic link icon
Write from the parent to the source node.
Read/write
Read and write direction for dynamic link icon
Read from the source node to the parent and write from the parent to the source node.
Default for dynamic links created in
FactoryTalk Optix Studio
UI.
Dynamic link
One or more variables identified by:
{
index_number
}
placeholder
Progressive integer equal to or greater than zero. For example,
{1}
{#
placeholder_identifier
}
placeholder
String prefixed with
#
. For example,
{#speed}
TIP: Use any combination of placeholders in any order. Use any number of placeholders in the expression.
This property is available only for converter instances and not converter types.

Output

The resulting value of the expression.

Examples

The following are examples of expression evaluator instances.
Return the absolute value of a variable
Expression evaluator block configured to calculate the absolute value of a
                        variable using abs({0}), with a dynamic link pointing to Variable2.
If variable value is higher than 40, toggle the visibility of a graphic object
Expression evaluator logic for visibility: if Variable1 is greater than 40,
            visibility is set to true; otherwise, it is set to false.
If variable value is higher than 50, change the background color of a graphic object to blue
Expression evaluator logic for visibility: if Variable1 is greater than 40,
            visibility is set to true; otherwise, it is set to false.
If variable value is between 30 and 40, blink the green led object when active
Expression evaluator configuration showing a conditional expression that blinks a green LED object when Variable3 is between 30 and 40. The expression uses if({0}>=30&&{0}<=40,true,false) and links to Variable3.
If text box border color is red, enable the button
Expression evaluator configuration for enabling a button based on the text box border
            color. Includes dynamic links for color and ColorRed, and an expression comparing values
            to determine button state.
If the label text equals to "WARNING", change the label text color to red
Expression evaluator configuration for text color: conditional logic checks if the
            label text is "WARNING" and applies ColorRed; otherwise, ColorGreen is used. Dynamic
            links reference the text value and color definitions.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal