beautypg.com

Example 1: a macro called factory, Example 2: a macro using placeholders in commands – Rockwell Automation FactoryTalk View Site Edition Users Guide User Manual

Page 641

background image

24

A

DDING

LOGIC

AND

CONTROL

24–13

• •

24

Pla
ceho

lde

r

To indicate percent in a macro, use two percent signs (%%). One percent sign
indicates a parameter in the macro. For details, see page 24-14.

Example 1: A macro called Factory

A macro called Factory contains the following commands:

Display /Ingredients::Overview

Display /Ingredients::Detail

/Ingredients::Valve23 =Open

When the macro runs, the graphic display called Overview opens, then the display called
Detail opens, and then the tag Valve23 is set to its open state.

The displays and the tag all are located in the area called Ingredients.

Example 2: A macro using placeholders in commands

The first two entries in this macro are Display commands that use placeholders:

Display /$Tag1$::Process1

Display /$Tag1$::TrendDisplay$Tag2$

Valve23=Open

When the macro runs, FactoryTalk View replaces the placeholders ($Tag1$, $Tag2$) with
the current values of the specified tags.

For example, if Tag1 (a string tag) = Mixing, and Tag2 (an analog tag) = 2, then the
graphic display Process1 from the Mixing area opens, followed by the display
TrendDisplay2, also from the Mixing area.

Finally, the tag Valve23 from the home area is set to its open state. In this example, the
home area is also the area, in which the macro is run.

You don’t need to put brackets around tag names when using placeholders in commands.

Do not use dollar signs or percent signs in comments inserted in macros. This causes errors
at run time.