Where you can use expressions, Format expressions – Rockwell Automation FactoryTalk View Machine Edition Users Guide User Manual

Page 482

Advertising
background image

F

ACTORY

T

ALK

V

IEW

M

ACHINE

E

DITION

U

SER

S

G

UIDE

23-4

• •

For details about using the options in the Expression editor, see Help.

Where you can use expressions

You can use expressions in these editors:

Graphics—You can define an expression to control various aspects of a graphic
object’s appearance. For more information about assigning expressions to graphic
objects, see page 20-37.

You can also use expressions to attach animation to graphic objects. For more
information, see Chapter 22.

Global Connections—You can use expressions to remotely control when to open and
print displays, as well as the date and time to show. For more information, see
Chapter 8.

Alarm Setup—When setting up alarms, you can use expressions for alarm triggers,
and with some of the connections that silence and acknowledge alarms. For more
information, see Chapter 9.

Information Setup—You can use expressions to determine when to show information
messages. For more information, see Chapter 27.

Macros—You can use expressions in macros to assign values to tags. For more
information, see page 30-1.

Format expressions

You can format expressions so they are easier to read. However, do not let tag names,
function names, or function arguments span more than one line.

When formatting expressions, you can use line returns and multiple spaces.

Enclose strings in quotes. The string can contain any character, and can include spaces.

Example: Format an expression

To format this if-then-else statement, you can align the Else with the appropriate If, so the
logic is easy to understand:

if (tag1 > tag2) then 0
else if (tag1 > tag3) then 2
else 4

Or you can condense it to the following:

if (tag1 > tag2) then 0 else if (tag1 > tag3) then 2 else 4

Advertising