Expression components, Use the expression editor, Expression components -2 – Rockwell Automation FactoryTalk View Machine Edition Users Guide User Manual

Page 480: Use the expression editor -2

Advertising
background image

F

ACTORY

T

ALK

V

IEW

M

ACHINE

E

DITION

U

SER

S

G

UIDE

23-2

• •

Expression components

Expressions can be built from:

Tag values.

Tag placeholders.

Constants.

Arithmetic, relational, logical, and bitwise operators.

Mathematical and security functions.

If-then-else logic.

Tags, arithmetic operators, bitwise operators, and mathematical functions such as SQRT
(square root) return numeric values.

Relational and logical operators return true/false values. The security function
CurrentUserHasCode(x) also returns a true/false value.

The security function CurrentUserName( ) returns a string value. The language function
CurrentLanguage( ) returns a string value.

Expressions that use if-then-else logic can return numeric values, true/false values, or text
strings, depending on how they are 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 statement.

The Objects 5 Screen Demo sample application contains many examples of expressions.
For example, see the alarm trigger expressions in the Alarm Setup editor.

Use the Expression editor

To create an expression, you can:

Type it directly in the “Tag or expression” column, for any connection that accepts
expressions, or in the Expression box (for animation).

Open the Expression editor, and then create the expression in the editor.

Use the Expression editor versus typing expressions directly

Once you are familiar with expression syntax, you might find it quicker to create short
expressions by typing them directly in the “Tag or expression” column.

The Expression editor allows you to see more text at once, which is useful for longer,
more complicated expressions. Also, you can click buttons to enter tag names, operators,

Advertising