Create an expression

To create an expression, you can:
  • Type it directly into the expression/binding box.
  • Open the
    Expression Editor
    and create the expression in the editor.
View Designer
checks the expression syntax while the expression is created. A red outline appears around the expression when invalid syntax is detected. The red outline disappears when the syntax becomes valid.
To create an expression
  1. Type the expression using any combination of the following:
    • Numeric Literals. Use positive and negative numbers.
    • Literal or tag string values. Combine string values that result in a single string value or assign a value to a text property.
    • Tags. Use tags as part of an expression or as the entire expression.
    • Numeric operators. Perform math on two or more numeric values and calculate the result.
    • Math functions. Perform operations such as trigonometric or logarithmic calculations on a tag or expression.
    • String functions. Change the case of characters in a string.
    • Conditional statements. Use these IIF functions to evaluate to true (1) or false (0).
    • Relational operators. Compare two numeric or string values to provide a true (1) or false (0) result.
    • Logical operators. Determine the validity of one or more statements and return a true (1) or false (0) result.
    • Bitwise operators. Examine and manipulate individual bits within a value.
    • Properties of graphic elements. Use the values of graphic element properties in expressions so that if the property values change, the result of the expression evaluation changes. The property values of graphic elements that reference this property also change when the result of the expression evaluation changes.
    • Punctuators. Specify the order of operations.
    • White space. Format an expression using spaces, tabs, and new lines so that it is easier to understand.
  2. (optional) When creating the expression using the
    Expression Editor
    , click
    OK
    to save the expression.
    IMPORTANT:
    • To avoid confusion, do not create a user-defined property with the same name as a property of a graphic element on the screen. When using a user-defined property name in an expression or binding in a graphic element that contains a property with the same name, the expression or binding uses the value of the graphic element property, not the value of the user-defined property.
      • Using an alias property in an expression is not supported.
      • The HMI device updates data from controllers at a fixed rate of 100, 250, or 500 milliseconds. This update is asynchronous to any scan in a controller.
TIP:
Tips:
  • Negation is supported for tags, numbers, and anything in parentheses.
  • Cutting, copying, and pasting expressions or parts of expressions between editors is not supported.
  • Function names are case sensitive. In general, all upper case, all lower case, and Pascal case are accepted.
  • Verify the syntax of all expressions in a project by clicking
    PROJECT > Verify Project
    any time during the project development process. The results of project verification display in the
    Errors
    window.
  • Expressions can contain Unicode characters.
    View Designer
    supports Unicode characters that appear in the Arial Unicode MS font.
  • When inserting text that contains Unicode characters in a graphic element, select
    Arial Unicode MS
    in the
    FontName
    property of the graphic element. Supported Unicode characters appear on the HMI device.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal