Expressions

An expression can be a tag name, a tag placeholder, a mathematical or logical equation, or a function that returns a numeric, string, or true or false value. For expressions that return true and false values, 1 and other nonzero values signify True, and zero signifies False. Expressions let you manipulate the data gathered from devices and make it more meaningful by comparing it to other values, combining it with other values, creating cause and effect relationships between values, or displaying it.
Expressions can contain:
  • Tags, tag placeholders, arithmetic, and bitwise operators, and mathematical functions such as SQRT (square root) that return numeric values.
  • Relational and logical operators, and functions such as ALM_FAULT (alarm fault) that return true/false values.
  • Non-mathematical functions, such as the CurrentLanguage function that returns the RFC17766 code for the current language of an application.
  • If-Then-Else logic that returns numeric or true and false values, depending on how it's structured. These are called conditional expressions because the result of the expression depends on whether the If statement is true or false. When the If statement evaluates to True, the result is defined by the Then statement. When the If statement is False, the result is defined by the Else
In FactoryTalk View Studio, you can set up expressions in the following editors:
  • In the
    Graphics editor
    , use an expression to control the appearance of a graphic object, or to display the value of an expression in a numeric or a string display object.
    You can also use expressions to set the value of a tag, using the
    If
    or
    Set
    command. For details, see the FactoryTalk View Site Edition Help.
  • In the
    Derived Tags editor
    , specify the name of a tag that will store the result of an expression.
  • In the
    Events editor
    , associate an expression with an action (a command or macro). When the expression changes from
    false
    to
    true
    (from
    0
    to any non-zero value), the action runs.
  • In the
    Data Log Models editor
    , when setting up file management for a data log model, use an expression to determine when log files are created.
If a graphic display requires mores than 20 HMI tag alarm functions, for performance reasons it is better to use the alarm functions in derived tags.
Remarks
  • Do not use the alarm functions in the Expressions editor with the
    If
    command because it will always return a
    0
    (zero). However, the alarm functions work correctly when used in the
    If-Then_Else
    logic in an expression.
  • When you use the Command wizard to create a command string that contains the
    Equals
    (=) or
    Set
    command, and an expression, you can type the expression for the command, but the Expression editor is not available.
  • If you are going to use direct references to non-HMI tags in an expression, the tag names must be enclosed in curly brackets, for example, {
    Non-HMI tag
    }.
  • If you are using FactoryTalk alarm and event functions, direct references to tags must be enclosed in double quotation marks which are enclosed in round brackets. For example, (
    "::/AreaPath::AlarmName"
    ) for an absolute path, or (
    "AlarmName"
    ) for a relative path. For more information about using FactoryTalk alarms and events, see the FactoryTalk Alarms and Events help.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal