Viewme Um004 - en e 363 423

Download as pdf or txt
Download as pdf or txt
You are on page 1of 61

Chapter 22

Animate graphic objects

This chapter describes:


• The types of animation and which objects support which types of
animation
• How to use the Animation dialog box
• How to test animation
• How to use tag names, tag placeholders, and expressions when
attaching animation
• How to set the minimum and maximum values for animation that
uses a range of motion
• How to use Object Smart Path to define an object’s range of motion
• How to set up each type of animation
• How to apply animation to groups
• How to check what kind of animation is attached to an object
• How to copy and paste animation
• How to set up animation for global objects
Types of animation Animation associates graphic objects with tags so the appearance or position
of an object changes to reflect changes to the tag’s value. For example, an
object’s color could change from yellow to orange to red as the tag’s value
increases. Or a slider could move from left to right as a tag’s value increases.
You can use these types of animation:
• Color
• Fill
• Height
• Horizontal position
• Horizontal slider
• Hypelrink
• Rotation
• Vertical position
• Vertical slider
• Visibility
• Width
The Objects 5 Screen Demo sample application contains many examples of
animation. In particular, see the graphic displays called Animation I and
Animation II.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 363


Chapter 22 Animate graphic objects

Which objects can have This table summarizes which types of objects support which types of
animation. For information about the different types of graphic objects, see
which types of animation? Types of graphic objects on page 291.

These objects Support these types of animation


Drawing objects, except images, panels, and All types
rounded rectangles
Rounded rectangles All types except rotation
All other objects Visibility

You can also attach animation to groups of drawing objects. For more
information, see Apply animation to groups on page 374.
You can attach as many types of animation to a drawing object (except images
and panels) as you like. For example, apply width, height, horizontal position,
and vertical position animation to an object to give it the appearance of
moving into or out of the display as it shrinks and grows.

Use the Animation dialog The Animation dialog box is a floating dialog box, which means you can keep
it open all the time and move it around the screen. While it’s open you can
box select other objects and open other dialog boxes.

For details about the parts of the Animation dialog box, see Help.

To open the Animation dialog box, use one of these methods:


• Select an object, and then from the View menu, select Animation.
• Select an object, and then from the Animation menu, select an
animation type. Animation types that are not supported for the
selected object are unavailable.

364 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 22 Animate graphic objects
• Right-click an object, select Animation, and then select an animation
type. Animation types that are not supported for the selected object are
unavailable.

Use Object Smart Path to Because the Animation dialog box stays open, you can go back and forth
between the dialog box and the graphic display. This makes it easy to set the
visually set animation
range of motion for an object because you do not have to know how many
pixels you want an object to move. Instead, you can set the range of motion
visually using the Object Smart Path feature. For details, see Use Object Smart
Path on page 367.

Test animation To test the animation you have set up on a graphic display, use Test Display to
switch to test mode. When you finish testing, switch back to edit mode to
continue editing.

To switch between test and edit modes, do one of the following:


• From the View menu, select Test Display or Edit Display
• On the toolbar, click or .
Tip: Test mode is not the same as running the display. Test mode does not change the
appearance or position of the display as set up in the Display Settings dialog box. Also,
data logging is not turned on in test mode.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 365


Chapter 22 Animate graphic objects

Use tag names and tag When setting up animation for objects, you are linking objects to tags. You
can specify a tag name or use tag placeholder.
placeholders
You can use HMI tags or data server tags that already exist, or you can use a
new tag name.
Tag placeholders allow you to create displays that can be used with different
tags.
You can use tag placeholders in:
• The graphic display that opens when the application is first run.
• Graphic displays that are opened using a Goto display button.
• Graphic displays that are opened using a display list selector.
• The graphic display that opens when the logout button is pressed.
• The graphic display that opens when auto logout is used.
• Graphic displays that are opened using the Remote Display Number
global connection.
Use parameter files or parameter lists to specify which tags or folders to
substitute for which placeholders. For global objects, you can specify the tags
or folders of tags using global object parameters. For more information about
using parameter files, parameter lists, and global object parameters, see Use
parameters and global objects on page 403.
The tag placeholder can replace any part of a tag name, including folder
names. For example, you could create a parameter file specifying that the tag
placeholder #1=Folder1. You could assign the folder and a tag name to a
graphic object’s connection: #1\Tag1.

To create a tag placeholder


• In the Expression box, type the cross-hatch character followed by a
number (no space in between). For example, #1.
Use expressions Many types of animation can be achieved using expressions. You can use
expressions containing tag values, constants, mathematical equations,
security functions, and if-then-else logic. A tag name or tag placeholder can be
included as part of an expression, or it can stand alone as the entire
expression.

For more information about expressions, see Use expressions on page 379.

Set minimum and maximum Many types of animation require a minimum and maximum range for the tag
or expression. These values determine the start and end points for a range of
values motion.
For example, if you specify a minimum of 0 and a maximum of 100, the object
will not react to values outside of this range. So, even if the expression has a
value of 200, the object does not change from its At maximum position.

366 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 22 Animate graphic objects
When setting up animation, select one of these methods for calculating the
minimum and maximum values:
• Use tag’s min and max property values — select this method to use the
minimum and maximum values of the first HMI tag in the expression.
If more than one HMI tag is used in the expression, the first HMI tag’s
minimum and maximum values are used.
For analog HMI tags, the values are taken from the Minimum and
Maximum boxes in the Tags editor. For digital tags, the minimum is 0
and the maximum is 1.
• Use constant — select this method to use numeric constants. Type the
minimum and maximum values in the boxes.
• Read from tags — select this method to read two tags’ values to
determine the minimum and maximum values. Type the tag names in
the boxes, or click the Browse buttons to open the Tag Browser
and select the tags.
If you use this method, the tags are read when the graphic display
opens. Their values at that time are used for the minimum and
maximum values. The tags are not read again after this.
Define a range of motion
To define a range of motion for an object, use one of these methods:
• Use the mouse to move the object on the display. This uses the Object
Smart Path feature to visually define the range of motion.
• Type values in the At minimum and At maximum boxes.
Motion can be defined in pixels, percentages, or degrees.

Animation that does not use Visibility and color animation do not use a range of motion, because these
types of animation represent a change of state, not a range of values.
a range of motion

Use Object Smart Path With Object Smart Path, you can easily set the range of motion for an object.
The following example shows how Object Smart Path works.

Example: Use Object Smart Path to define the range of motion for
horizontal slider animation

To define a range of motion for a slider object


1. In the Graphics editor, create a slider object using a line and a
rectangle, or copy a slider object from the Sliders graphic library.
2. Open the Animation dialog box and click the Horizontal Slider tab.
3. On the display, select the rectangle in the slider object.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 367


Chapter 22 Animate graphic objects
4. In the Tag box of the Animation dialog box, specify a tag name.

5. On the display, drag the rectangle to the position that will indicate the
lowest number in the range.

6. In the Animation dialog box, set this position by clicking the At


minimum check box.

7. On the display, drag the rectangle to the position that will indicate the
highest number in the range.

8. In the Animation dialog box, set this position by selecting the At


maximum check box.

9. To save the settings, click Apply.


When you finish setting up the animation, the rectangle returns to its original
position.

Set up the different types of This section describes the different types of animation and provides tips and
examples for setting up animation.
animation
Set up visibility animation With visibility animation, an object becomes visible or invisible based on a tag
value or the result of an expression. When an object is invisible, it cannot be
selected. Mouse clicks pass through it to whatever object is underneath.
Visibility animation is available for all objects and overrides an object’s Visible
property.

368 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 22 Animate graphic objects
Tip: If you use a tag’s value to control visibility animation as well as in an expression to control
some other aspect of animation, when you set up visibility, set the Expression true state to
Invisible. If you do not do this, the object could appear briefly in its design-time location and
orientation before animating properly.

For more information about setting up visibility animation, see Help.

Example: Use visibility animation to set up security for a graphic


display
This example shows how to use visibility animation to control what operators
can see. On a graphic display that all users have access to, only the Admin user
can see the graphic object to which this animation is attached.
This example uses the security function CurrentUserName( ). The function
returns the string value of the Account ID (user name) for the user who is
currently logged in.
The CurrentUserName( ) function is case sensitive. All user names use
uppercase letters, so make sure that you use uppercase letters in your
expression.

To specify which user can view an object in a display


1. Select the object to limit visibility to.
2. Open the Animation dialog box and click the Visibility tab.
3. In the Expression box, type this:
CurrentUserName( ) == "ADMIN"
4. For the Expression true state, select Visible.
5. Click Apply, and then click Close.
At runtime, the object is visible only if the Admin user is logged in.

Set up color animation With color animation, an object changes color based on a tag value or the
result of an expression. You can specify up to 16 color changes (A to P) for any
object. Colors can be solid or blinking. For each color change, specify the value
or threshold at which the color is to change and specify the colors to change
to. At runtime, when the value reaches or crosses the threshold, the color
changes.
Color animation is available for all drawing objects only except image and
panel objects, which only support visibility animation.
Use the Fill Style option to control the look of the fill color.
Use this fill style To
Solid Change the colors, and they will have a solid look to them.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 369


Chapter 22 Animate graphic objects
Use this fill style To
Gradient Change the colors, and they will have a gradient look to them. If you select Gradient
as the Fill Style, the Fill color box changes to gradient. Click it to bring up the
gradient fill dialog box to configure the gradient fill.
Original Prevent the colors of the object to be changed from what was originally imported.
Shaded Use a tight dot pattern to soften or give a shaded appearance.
The Shaded fill style takes effect only on the group object that is composed of
individual objects with dark to light colors, such as the Symbol Factory objects.

The following example shows the effects of Shaded and Gradient fill styles.

Keep Original Color Using the Original Fill Style allows for more variations on animating an
object. Instead of a specific color for the object’s non-blink state, the object’s
original color can be used.
If Original is used as a Fill Style on any state, the color palette boxes will not
allow a color change. By selecting the Blink option, a different color can be
used for both the Line and the Fill color or individually.

Control Color Shading Using the Shaded Fill Style along with the Blink option allows control of the
shading aspect of a display object by changing combinations of Line and Fill
and different colors.
For more information about setting up color animation, see Help.

Example: Create a text This example describes how to create a text object that constantly blinks
between two colors. Since the blinking is not based on changes in tag values,
object that blinks the expression is simply a constant value that matches the value for the
selected threshold.
For details about creating text, see Create text on page 301.
1. Select the text object.
2. Open the Animation dialog box, and then click the Color tab.
3. In the Expression box, type 0.
Zero is the default value for threshold A.
4. In the list box, click threshold A. (Leave the value in the Value box as 0.)
5. For the line color, click Blink. (If desired, click Blink for the fill color
too.)
6. For each color, click the color box, and then click the color to use.
7. Click Apply.
Example: Create an object This example describes how to create a rectangle object that changes color as
the object’s fill level increases. This example uses a tag called
that changes color as the
Hopper1\FlourLevel. The tag has a range of 1 to 100. When the flour level
fill level changes reaches 80, the rectangle blinks between gray and yellow to warn the operator

370 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 22 Animate graphic objects
that the hopper is nearly full. When the flour level reaches 95, the rectangle
blinks between gray and red.
You could use a bar graph object (without animation) to achieve a similar
result.
1. Double-click the rectangle to open the Polygon Properties dialog box.
Assign these properties to the rectangle:
• In the Back style box, select Solid.
• For the Fore color and Back color, select gray.
2. Click OK to close the Polygon Properties dialog box.
3. With the rectangle selected, open the Animation dialog box, and then
click the Fill tab.
4. Attach fill animation as follows:
• In the Expression box, type Hopper1\FlourLevel (this is the tag that
monitors the fill level).
• For Fill Direction, click Up.
5. Click the Color tab, and then attach color animation as follows:
• In the Expression box, type Hopper1\FlourLevel (the same tag that
was used in the Fill tab).
6. Set up the color for the normal state
• In the List box, select A. (In the Value box, leave the value as 0.)
• For Fill Style, select Solid.
• For Line and Fill, select the color box, and then select gray (the same
gray used for the rectangle).
7. Set up the color for the first warning
• In the List box, select B.
• In the Value box, type 80.
• For Line and Fill colors, select Blink. A palette box will be shown for
the Blink color.

• For the line colors, select gray for the first color and yellow for the
blink color. Repeat for the fill colors.
8. Set up the color for the second warning
• In the List box, select C.
• In the Value box, type 95.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 371


Chapter 22 Animate graphic objects
• For the Line and Fill, select Blink. A palette box will be shown for the
Blink color.

• For the line colors, select gray for the first color and red for the blink
color. Repeat for the fill colors.
9. Click Apply.
Set up fill animation Use the Fill option on the Animation menu to change the fill level in an object
when an expression or tag value changes. The object's fill level is proportional
to the minimum and maximum values specified for the expression. For
example, if the value of the expression is halfway between its minimum and
maximum values, the object will be half full.
You can attach fill animation to drawing objects only. The exceptions are the
image and panel objects, which only support visibility animation.
If you select the Inside Only check box, fill animation does not affect objects’
borders, line objects, or objects with transparent backgrounds.
For more information about setting up fill animation, see Help.

Set up horizontal position Use the Horizontal Position option on the Animation menu to move an object
horizontally as a tag value or the results of an expression change. The
animation horizontal position of the object is proportional to the value of the expression.
For example, if the value of the expression is halfway between its minimum
and maximum values, the horizontal position of the object will be halfway
between its minimum and maximum horizontal offset positions.
You can attach horizontal position animation to drawing objects only. The
exceptions are the image and panel objects, which only support visibility
animation.
For more information about setting up horizontal position animation, see
Help.

Set up vertical position Use the Vertical Position option on the Animation menu to move an object
vertically as a tag value or the results of an expression change. The vertical
animation position of the object is proportional to the value of the expression. For
example, if the value of the expression is halfway between its minimum and
maximum values, the vertical position of the object will be halfway between its
minimum and maximum vertical offset positions.
You can attach vertical position animation to drawing objects only. The
exceptions are the image and panel objects, which only support visibility
animation.

372 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 22 Animate graphic objects
To move an object on the display "up", a negative offset number is required.
The top-left corner of the display has the coordinates of 0,0.
For more information about setting up vertical position animation, see Help.

Set up width animation With width animation, an object’s width changes based on a tag value or the
result of an expression. The width of the object is proportional to the value of
the expression. For example, if the value of the expression is halfway between
its minimum and maximum values, the width of the object will be halfway
between its minimum and maximum horizontal change percents.
Width animation is available for all drawing objects except image and panel
objects, which only support visibility animation.
For more information about setting up width animation, see Help.

Set up height animation With height animation, an object’s height changes based on a tag value or the
result of an expression. The height of the object is proportional to the value of
the expression. For example, if the value of the expression is halfway between
the minimum and maximum values, the object’s height will be halfway
between its minimum and maximum vertical change percents.
Height animation is available for all drawing objects except image and panel
objects, which only support visibility animation.
For more information about setting up height animation, see Help.

Set up rotation animation With rotation animation, an object rotates around an anchor point based on a
tag value or the result of an expression, with the angle of rotation of the object
being proportional to the value of the expression. For example, if the value of
the expression is halfway between the minimum and maximum values, the
object will rotate half the specified amount.
Rotation animation is available for all drawing objects except images, panels,
and rounded rectangles. If you apply rotation animation to text, the text
rotates around the anchor point but remains in the upright position.
For more information about setting up rotation animation, see Help.

Set up hyperlink animation With hyperlink animation, an object links to a destination. When the object is
clicked at run time, in Test application mode, or in Test Display mode, the
linked destination opens. The destination can be a file, a web page, or a
program.
Hyperlink animation is available for all drawing objects except image and
panel objects which only support visibility animation.
For more information about setting up hyperlink animation, see Help.

Set up horizontal slider Use the Horizontal Slider option on the Animation menu to create a graphic
object that can control the value of a specified tag. With horizontal slider
animation animation, you define a path for the object, then use the mouse to move the

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 373


Chapter 22 Animate graphic objects
object horizontally along its path. The pixel position of the object is translated
into a value that is written to the tag.
A tag that has values input by slider animation can be used in an expression to
attach animation to another object or group of objects. If the tag value is
changed externally, the position of the slider will change as well.
Both vertical and horizontal slider animation can be attached to the same
object.
You can attach horizontal slider animation to drawing objects only. The
exceptions are the image and panel objects, which only support visibility
animation.
For more information about setting up horizontal slider animation, see Help.
Tip: The Sliders graphic library contains several slider objects you can drag and drop into your
graphic displays. Attach slider animation to the button portion of the slider object.
If you create your own slider object, it’s useful to draw an object (for example, a line) to represent
the path the slider will move along.

Set up vertical slider Use the Vertical Slider option on the Animation menu to create a graphic
object that can control the value of a specified tag. With vertical slider
animation animation, you define a path for the object, then use the mouse to move the
object vertically along its path. The pixel position of the object is translated
into values that are written to the tag.
A tag that has values input by slider animation can be used in an expression to
attach animation to another object or group of objects. If the tag value is
changed externally, the position of the slider will change as well.
Both vertical and horizontal slider animation can be attached to the same
object.
You can attach vertical slider animation to drawing objects only. The
exceptions are the image and panel objects, which only support visibility
animation.
For more information about setting up vertical slider animation, see Help.

Apply animation to groups You can apply animation to objects and then group those objects and apply
animation to the group. When the display is running, animation is applied as
follows:

These types of animation Are applied like this


Color Animation attached to individual objects within the group overrides
group animation.
Fill Animation results for both the individual objects and the group are
applied.
Horizontal slider, hyperlink, Group animation overrides animation attached to individual objects
vertical slider within the group.

374 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 22 Animate graphic objects

These types of animation Are applied like this


Height, width, horizontal position, Animation results for individual objects and the group are combined. For
vertical position, and rotation example, if an individual’s horizontal position animation result is to
offset the object by 100 pixels, and the group’s result is to offset the
group by 200 pixels, the individual object is offset by 300 pixels.

Visibility When the group’s animation visibility is False (the group is not visible),
then no objects in the group are visible, regardless of the animation
status of the individual objects.
When the group’s animation visibility is True (the group is visible), the
visibility of an object within the group is determined by the individual
object animation.

Test your animation to ensure you achieve the intended results.


To apply animation to objects within groups, use the group edit feature. For
details, see Edit groups of objects on page 331.

Check the animation on To see what type of animation has been set up for an object or group of
objects, use the Object Explorer, the Animation menu, or the Animation
objects dialog box.
For information about using the Object Explorer to highlight objects that
have animation attached, see Highlight objects in the Object Explorer on page
312.
To see what type of animation has been set up for objects within a group, use
the group edit feature or the Object Explorer. For information about using the
group edit feature, see Edit groups of objects on page 331.

View the animation on an


object using the Animation To view the animation on an object using the Animation menu
menu 1. Select an object.
2. View the animation by doing one of the following:
• Click the Animation menu and see which items have a check mark.
• Right-click the object and then select Animation to see which items
have a check mark.
View the animation on an
object using the Animation To view the animation on an object using the Animation dialog box
dialog box 1. Select an object.
2. From the View menu, select Animation.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 375


Chapter 22 Animate graphic objects
When the Animation dialog box opens, look at which tabs have check
marks on them to see which types of animation have been set up.

Copy or duplicate objects You can copy or duplicate objects that have animation attached to them.
with animation When you do, the animation attached to the objects is also copied or
duplicated. If you copy or duplicate a group, the copy of the group can be
ungrouped to individual objects, just like the original.
For information about copying and duplicating objects, see pages Copy
objects on page 325 and Duplicate objects on page 327.

Copy animation without If you have attached animation to an object, you can copy the animation and
paste it onto another object. If the object has more than one type of
copying objects animation, all animation is copied and pasted. Note that you can only copy
animation to an object that supports the same type of animation.

To copy and paste animation


1. Select the object that has the animation you want to copy.
2. From the Edit menu, select Copy Animation, or right-click the object
and then select Copy Animation.
3. Select the objects to copy the animation to.
4. From the Edit menu, select Paste Animation.
To paste to a single object, you can right-click the object and then select Paste
Animation.

Set up animation for global FactoryTalk View global objects allow you to link the appearance and behavior
of a graphic object to multiple copies of that object. When the original base
objects object is updated, the changes are automatically applied to all the copies of the
object. For information about creating base objects, see Use global objects on
page 410.
The copies of the object are called reference objects, and they have the same
properties as the original base object. If desired, you can assign unique
animation to the reference object. For information about creating reference
objects, see Create reference objects on page 412.

376 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 22 Animate graphic objects
The LinkAnimation property determines whether the reference object uses
the base object’s animation.

To set up animation for a reference object


1. Double-click the reference object to open the Property Panel.
2. Select the LinkAnimation property setting to use:
• Do not link — allows you to set up separate animation for the
reference object.
• Link with expressions — the reference object uses the animation
and tags or expressions assigned to the base object.
• Link without expressions — allows you to use only the types of
animation set up for the base object, but assign different tags or
expressions to the reference object.
3. If you selected Do not link or Link without expressions, set up
animation for the object using the methods described in this chapter.
For more information about setting up link properties and working with
reference objects, see Set up reference objects’ link properties on page 413.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 377


Chapter 23

Use expressions

This chapter describes:


• The types of expression components
• How to use the Expression editor
• Which editors use expressions
• How to format expressions
• How to use tag names and tag placeholders with expressions
• How to use constants
• How to use operators
• How to use math, security, and language functions
• How to use if-then-else logic in expressions
• The evaluation order of operators
• How to use write expressions
About expressions Sometimes the data you gather from devices is meaningful only when you:
• Compare it to other values.
• Combine it with other values.
• Create a cause-effect relationship with other values.
Expressions allow you to create mathematical or logical combinations of data
that return more meaningful values.
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 non-zero 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.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 379


Chapter 23 Use expressions
• 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 statement.
Use expressions in:
• Graphic displays
• Alarm setup
• Information setup
• Macros
• Global connections
The Objects 5 Screen Demo sample application contains many examples of
expressions. For example, see the alarm trigger expressions in the Alarm
Setup editor.

Expressions that result in If an expression results in a floating-point value but an integer value is
required, the floating-point value is rounded.
floating-point values
For information about how values are rounded, see How values are rounded
on page 86.

Use the Expression editor


To create an expression, use one of these methods:
• 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 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
versus typing expressions
column.
directly
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, and functions, thus avoiding typing mistakes. Another
advantage of using the Expression editor is that you can check whether the
syntax of the expression you have created is valid.

Create an expression by
typing it directly To create an expression by typing it directly
• Type an expression up to 16,000 characters long.
Expressions that you type directly are not checked for syntax.

Open the Expression editor

380 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 23 Use expressions

To open the Expression editor, use one of these methods:


• Click the Browse button in the Exprn column for a connection
that accepts expressions.
The Browse button is not available for connections to which you can
assign only tags.
• In the Animation dialog box, click the Expression button.
The Expression editor has these parts:

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

Where you can use You can use expressions in these editors:

expressions • 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 Use expressions to manipulate tag
values on page 320.
You can also use expressions to attach animation to graphic objects.
For more information, see Animate graphic objects on page 363.
• 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 Set up global connections on page 97.
• 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 Set up alarms on page
103.
• Information Setup — You can use expressions to determine when to
show information messages. For more information, see Information
messages on page 425.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 381


Chapter 23 Use expressions
• Macros — You can use expressions in macros to assign values to tags.
For more information, see Use macros to assign values to tags on page
457.
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

Use tag names and tag A tag name can be included as part of an expression or can stand alone as the
entire expression.
placeholders

To supply a tag name, use one of these methods:


• Type a tag name.
You can type a tag name that does not exist in the tag database. When
you click OK, you are prompted to create the tag. You can create it now,
or write down the name and create it later.
• Click the Tags button and select a tag from the Tag Browser.
Enclose tag names that contain dashes or start with a number in braces { }
when you use them in an expression. This distinguishes the characters in the
tag name from the characters in the expression.
You can use string tags as operands with the plus (+) arithmetic operator and
with the relational operators.

Use tag placeholders The Graphics editor accepts tag placeholders instead of tag names.
Placeholders allow you to use the same display with different sets of tags.
instead of tag names
You can use tag placeholders in:
• The graphic display that opens when the application is first run.
• Graphic displays that are opened using a Goto display button.
• Graphic displays that are opened using a display list selector.

382 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 23 Use expressions
• The graphic display that is opened by a logout button.
• The graphic that is opened when auto logout is used.
• Graphic displays that are opened using the Remote Display Number
global connection.
Use parameter files to specify which tags or folders to substitute for which
placeholders. For global objects, you can specify the tags or folders of tags
using global object parameters. For more information about using parameter
files and global object parameters, see Use parameters and global objects on
page 403.
The tag placeholder can replace any part of a tag name, including folder
names. For example, you could create a parameter file specifying that the tag
placeholder #1=Folder1. You could assign the folder and a tag name to a
graphic object’s connection: #1\Tag1.

To create a tag placeholder in an expression


• Type the cross-hatch character followed by a number (no space in
between). For example, #1.

Constants A constant can have any of the following formats:


• Integer (123)
• Floating-point (123.45)
• String constant ("character string")
Arithmetic operators Arithmetic operators perform math on two or more numeric values and
calculate the result. The arithmetic operators are:

Example
Symbol Operator (For these examples, tag1 = 5 and tag2 = 7)
+ addition tag1 + tag2
returns a value of 12
You can also use this operator with string operands. See
String operands on page 384.
- subtraction tag1 - tag2
returns a value of -2
* multiplication tag1 * tag2
returns a value of 35
/ division tag1 / tag2
returns a value of 0.7142857
MOD,% modulus (remainder) tag2 MOD tag1
returns a value of 2
The modulus operator is the remainder of one number divided
by another. In the example, the remainder of 7 divided by 5 is
2; so 7 % 5 = 2
Important: This operator is for integers only, not floating-
point numbers.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 383


Chapter 23 Use expressions

Example
Symbol Operator (For these examples, tag1 = 5 and tag2 = 7)
** exponent tag1 ** tag2
returns a value of 78125

Be sure that any tag value you use as a divisor cannot at some point have a
value of zero. Expressions that attempt to divide a number by zero produce an
error at runtime.

String operands The + operator can be used to join string operands. For example, the
expression "hello" + "world" returns: helloworld.
You cannot join string tags to analog tags, whether they are HMI or data
server tags.

Relational operators Relational operators compare two numeric or string values to provide a true
or false result. If the statement is true, a value of 1 is returned. If false, 0 is
returned.
The relational operators are:

Symbols Operator Numeric Example String Example

For the numeric examples, tag1 = 5 and tag2 = 7


For the string examples, serial_no = "ST009"
EQ, == equal tag1 == tag2 serial_no == "ST009"
false true
NE, <> not equal tag1 <> tag2 serial_no <> "ST011"
true true
LT, < less than tag1 < tag2 serial_no < "ST011"
true true
GT, > greater than tag1 > tag2 serial_no > "ST011"
false false
LE, <= less than or equal to tag1 <= tag2 serial_no <= "ST011"
true true
GE >= greater than or equal to tag1 >= tag2 serial_no >= "ST011"
false false

How string operands are String operands are evaluated by case and by alphabetical order. Lower case
evaluated letters are greater than upper case letters. For example, h is greater than H.
Letters later in the alphabet are greater than those earlier in the alphabet. For
example, B is greater than A.

Logical operators Logical operators determine the validity of one or more statements. There are
three logical operators: AND, OR, and NOT. The operators return a non-zero
value if the expression is true, or a 0 if the expression is false.
Any statement that evaluates to a non-zero value is regarded as true. For
example, the statement tag1 is false if the value of tag1 is 0, and true if tag1 has
any other value.

The logical operators are:

384 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 23 Use expressions
Example
(For these examples,
Symbols Operator Action tag1 = 5 and tag2 = 7)
AND, && and Returns a 1 if the (tag1 < tag2) AND (tag1 == 5)
statements to the Both statements are true;
right and left of the returns a 1.
operator are both
true.
OR, || or Returns a 1 if either (tag1 > tag2) OR (tag1 == 5)
the statement to the tag1 == 5 is true;
left or right of the returns a 1.
operator is true.
NOT negation Reverses the logical NOT (tag1 < tag2)
value of the Although tag1 < tag2 is true,
statement it operates NOT reverses the logical value;
on. returns a 0.

Tip: The parentheses are essential in the above expressions. They determine the evaluation order
of the operators. For more information, see Evaluation order of operators on page 386.

Bitwise operators Bitwise operators examine and manipulate individual bits within a value.
IMPORTANT These operators are for integers only, not floating-point numbers. Do not use them
with tags or expressions that return floating-point values.

Symbol Operator Action


& And Compares two integers or tags on a bit-by-bit basis.
Returns an integer with a bit set to 1 if both the corresponding bits in
the original numbers are 1. Otherwise, the resulting bit is 0.

| inclusive OR Compares two integers or tags on a bit-by-bit basis.


Returns an integer with a bit set to 1 if either or both of the
corresponding bits in the original numbers are 1. If both bits are 0,
the resulting bit is 0.
^ exclusive OR (XOR) Compares two integers or tags on a bit-by-bit basis.
Returns an integer with a bit set to 1 if the corresponding bits in the
original numbers differ. If both bits are 1 or both are 0, the resulting
bit is 0.
>> right shift Shifts the bits within an integer or tag to the right.
Shifts the bits within the left operand by the amount specified in the
right operand. The bit on the right disappears.
Either a 0 or a 1 is shifted in on the left, depending on whether the
left-most bit is a 0 or a 1, and whether the operand consists of a
signed or unsigned data type.
For signed data types, if the left-most bit is 0, a 0 is shifted in. If the
left-most bit is 1, a 1 is shifted in. In other words, the sign of the
number is preserved.
For unsigned data types, a 0 is always shifted in.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 385


Chapter 23 Use expressions

Symbol Operator Action


<< left shift Shifts the bits within an integer or tag to the left.
Shifts the bits within the left operand by the amount specified in the
right operand. The bit on the left disappears and 0 always shifts in on
the right.
See Use the left shift operator on page 386.
~ complement Returns one’s complement; that is, it toggles the bits within an
integer or tag.
Reverses every bit within the number so every 1 bit becomes a 0 and
vice versa.

Use the left shift operator If the left bit is a 1 an overflow occurs, and an error message is generated. To
prevent this, use the bitwise AND operator with the left shift operator in an
expression. For example:
(dev << 1) & 65535
where dev is a tag whose value is being shifted left, and 65535 is 1111 1111 1111
1111 in binary form.

Examples: Bitwise operators


For these examples, tag1 = 5 (binary 0000 0000 0000 0101) and
tag2 = 2 (binary 0000 0000 0000 0010)
tag1 & tag2
Returns 0 (binary 0000 0000 0000 0000).
tag1 | tag2
Returns 7 (binary 0000 0000 0000 0111).
tag1 ^ tag2
Returns 7 (binary 0000 0000 0000 0111).
tag1 >> 1
Returns 2 (binary 0000 0000 0000 0010).
tag1 << 1
Returns 10 (binary 0000 0000 0000 1010).
~ tag1
Returns -6 (binary 1111 1111 1111 1010).

Evaluation order of Expressions with more than one operator are evaluated in this order:

operators • Operators in parentheses are evaluated first.


1. Therefore, to change the order of precedence, use parentheses.
• The operator with the highest precedence is evaluated next.
• When two operators have equal precedence, they are evaluated from
left to right.

386 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 23 Use expressions
Operators are evaluated in this order:

Evaluation order Symbols


1 (highest) ()
2 NOT
~
3 *
/
MOD, %
**
AND, &&
&
>>
<<
4 +
-
OR, ||
|
^
5 (lowest) EQ, ==
NE, <>
LT, <
GT, >
LE, <=
GE, >=

Examples: Evaluation order


For these examples, tag1 = 5, tag2 = 7, and tag3 = 10.
_____________________________
(tag1 > tag2) AND (tag1 < tag3)
is evaluated in this sequence:
1. tag1 > tag2 = 0
2. tag1 < tag3 = 1
3. 0 AND 1 = 0
The expression evaluates to 0 (false).
_____________________________
tag1 > tag2 AND tag3
is evaluated in this sequence:
1. tag2 AND tag3 = 1
2. tag1 > 1 = 1
The expression evaluates to 1 (true).
_____________________________

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 387


Chapter 23 Use expressions
NOT tag1 AND tag2 > tag3 ** 2
is evaluated in this sequence:
1. NOT tag1 = 0
2. 0 AND tag2 = 0
3. tag3 ** 2 = 100
4. 0 > 100 = 0
The expression evaluates to 0 (false).

Mathematical functions Use math functions to calculate the square root, log (natural or base 10), or
trigonometry ratios (in radians or degrees) of a tag.

This function Returns this value


SQRT (expression) The square root of the expression
LOG (expression) The natural log of the expression
LOG10 (expression) The base ten log of the expression
SIN (expression) The sine of the expression in radians
COS (expression) The cosine of the expression in radians
TAN (expression) The tangent of the expression in radians
ARCSIN (expression) The arc sine of the expression in radians
ARCCOS (expression) The arc cosine of the expression in radians
ARCTAN (expression The arc tangent of the expression in radians
SIND (expression) The sine of the expression in degrees
COSD (expression) The cosine of the expression in degrees
TAND (expression) The tangent of the expression in degrees
ARCSIND (expression) The arc sine of the expression in degrees
ARCCOSD (expression) The arc cosine of the expression in degrees
ARCTAND (expression) The arc tangent of the expression in degrees

Security functions Use security functions to control access to your application. These functions
allow you to determine a user’s identity or security rights to limit access to the
application based on these criteria.

This function Returns this value


CurrentUserName( ) A string containing the name of the current user.
This function is case sensitive. All RSView 3.20 and earlier user names
use uppercase letters.
CurrentUserHasCode(SecurityCod 1 (true) if any of the specified security codes have been assigned to the
e) user; 0 (false) if not.
The argument can be a security code, tag name, or tag placeholder. If
you use a tag name or tag placeholder, it must be enclosed in curly
brackets ({}), for example, CurrentUserHasCode({#1}).
If checking multiple security codes, do not type a space between the
security code letters.
For example, CurrentUserHasCode(ABP) returns the value 1 if the user
has been assigned one or more of the specified codes.

388 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 23 Use expressions

This function Returns this value


CurrentUserHasGroup("Group 1 (true) if the current user is assigned to the specified group configured
Name") in FactoryTalk Diagnostics; 0 (false) if not.
The argument can be a literal string, string tag, or tag placeholder. If you
use a string, it must be enclosed in double quotes, for example,
CurrentUserHasGroup ("UserGroupName1").
The argument can also be a combination of a literal string and string tag
in the format of “Liter string” + String tag, for example,
CurrentUserHasGroup
("UserGroupName1"+{[Controller]Main.UserGroupName}).
If CurrentUserHasGroup("Group C") returns the value 1, the user has been
assigned to Group C.
This function is only supported in 8.0 and later versions of FactoryTalk
ME applications.

If you use a tag parameter for the CurrentUserHasCode() or the


CurrentUserHasGroup () security function and create an 8.20 or earlier
version runtime application (.mer) using current version FactoryTalk View:
• The runtime application functions well.
• When you restore the runtime application to 8.20 or earlier version
design time application (.med) and create runtime application from
the design time application in FactoryTalk View 8.20 or earlier, the
security function does not work.
For more information about setting up security for your application, see Set
up security on page 155.
For an example of using the CurrentUserHasCode(x) function, see Example:
Assign visibility animation to the shutdown button on page 167.
For examples of using the CurrentUserName( ) function, see Example: Assign
visibility animation to the Goto display button on page 167.

Language function The language function shows you which language your application is
currently using.
You can show the current language in a string display, or use it in expressions
to generate language-specific messages for your users.

This function Returns this value


CurrentLanguage( ) RFC1766 name of the current runtime language.

The RFC1766 name is a standard way of representing a language using the


format: languagecode-Country/RegionCode
where languagecode is a lowercase two-letter code and Country/RegionCode is an
uppercase two-letter code.
For example, U.S. English is en-US.
For more information about setting up languages for your application, see Set
up language switching on page 173. For a list of RFC1766 names, see RFC1766
names on page 507.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 389


Chapter 23 Use expressions

Language switching alarm, FactoryTalk View 5.00 and later provides direct support for switching
message languages at runtime.
information, and local
For applications that will run in FactoryTalk View ME Station version 4.00,
messages in FactoryTalk use the CurrentLanguage( ) expression function to specify message offsets in
View ME Station 4.00 the information message file. In the file, divide your messages into sections
for each language. To do this, set up trigger value offsets for series of
messages in the Alarm Setup editor, information message files, and local
message files.
Export the text strings in the Alarm Setup editor and message files for
translation. Then paste the translated strings into the editor and original
message files, and assign each string the correct trigger value. For
information about exporting text for translation, see Set up language
switching on page 173.

Example: Set up information messages in multiple languages


This example shows how to generate English, French, or German information
messages at runtime in a FactoryTalk View ME Station 4.00 application,
depending on which language the application is using.
1. Create a tag called Information_messages that will generate trigger
values of 11 to 20 for different conditions that require information
messages.
2. Create an information message file.
3. Create English messages for trigger values 11 to 20.
Tip: Messages are sorted alphanumerically in the Excel spreadsheet or Unicode text file
created for translation. Therefore, numbers 2 through 9 would appear after 10, 11, 12, and so
on. To keep your messages in order in the translation file, begin the first series of numbers
at 11.
4. Create French messages for trigger values 21 to 30.
5. Create German messages for trigger values 31 to 40.
6. Assign this expression to the Value connection in the Information
Setup editor:
If CurrentLanguage( )="en-US" then
Information_messages
Else If CurrentLanguage( )="fr-FR" then
Information_messages + 10
Else Information_messages + 20

If-then-else If-then-else expressions carry out an action conditionally or branch actions


depending on the statements in the expression. The if-then-else statements
enable the expression to perform different actions in different situations and
to repeat activities until a condition changes.
To build conditional expressions, use the relational operators and the logical
operators for the statement and values.
The if-then-else structure is:

390 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 23 Use expressions
if statement then value1 else value2
If the statement is true then the expression returns value1; if the statement is
false then the expression returns value2. If the result of the statement is a
non-zero value, the statement is true (and returns value1); if the result is 0, the
statement is false (and returns value2).
The if-then-else structure is illustrated here.

Nested if-then-else You can also nest an if-then-else structure inside the Then or Else part of an
if-then-else structure.

Example 1: Nested if-then-else


This expression:
if statement1 then value1
else if statement2 then value2
else value3
has this interpretation:

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 391


Chapter 23 Use expressions

Example 2: Nested if-then-else


This expression:
if statement1 then
if statement2 then value1
else value2
else value3
has this interpretation:

Use write expressions Write expressions allow the operator to enter a value which is manipulated by
an expression before being sent to the data source. FactoryTalk View
substitutes the value the operator enters for the placeholder in the expression,
calculates the value of the expression, and writes the result to the Value
connection. All write expressions must contain a question mark (?) as a
placeholder for the value the operator enters.
You can use write expressions with the Numeric Input Enable button and the
numeric input cursor point. When the operator presses the button or cursor
point, a keypad or scratchpad opens. The operator enters a value in the keypad
or scratchpad, and this value is substituted for the ? placeholder in the write
expression.

Example: Use write expressions


In this example, the operator regulates the speed of a conveyor belt by
entering a value in feet or meters per second. When the operator enters the
value in meters per second, the value is converted to feet per second before
being passed to the data source.
The operator first indicates whether the value is in feet or meters by pushing a
Maintained push button. The push button has one state corresponding to feet
per second, and the other state to meters per second.

392 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 23 Use expressions
Then the operator presses the Numeric Input Enable button and enters the
value for the conveyor speed in a numeric pop-up keypad. The ? character in
the write expression is the placeholder for the value the operator enters.

Set up the Maintained push


button To set up the Maintained push button
1. In the Maintained Push Button Properties dialog box, on the States
tab, set up these states:
• State 0 — Value: 0, Caption: Feet/S
• State 1 — Value: 1, Caption: Meters/S
2. On the Connections tab, assign a digital tag called Feet_or_meters to
the Value connection (either an HMI tag or a data server tag).
Set up the Numeric Input
Enable button To set up the Numeric Input Enable button
1. On the Label tab of the Numeric Input Enable Properties dialog box,
type the caption Enter conveyor speed.
2. On the Connections tab, assign a tag called Conveyor_speed to the Value
connection.
3. Assign this expression to the Optional Exp connection:
if Feet_or_meters == 0 then
?
else
? * 3.281
FactoryTalk View writes the result of the expression to the Conveyor_speed
tag at the data source.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 393


Chapter 24

Use embedded variables

This chapter describes:


• The types of embedded variables
• Where you can create embedded variables
• How to create embedded variables
• Embedded variable syntax
• How embedded variables are updated at runtime
• How embedded variables are shown at runtime
About embedded variables Embedded variables allow you to show values that change dynamically at
runtime. Put placeholders in strings where the embedded variable will be
shown. At run time, the placeholder is updated with the real-time values of the
variables.
Embedded variables are of two kinds:
• A tag is read to provide the run-time value. Use tags, to embed tag
values (Numeric or String), date values, and time values. The tag is
read at run time and the current value is shown.
• A tag is not read. Use this type to embed literal strings and numbers
that will be shown at run time as they were entered.
Use one or more embedded variables in:
• The text captions on graphic objects
• The title bar of On Top displays
• Message text.
For example, you could embed a tag value and the time variable in a local
message. At run time when the local message is shown, it is updated to reflect
the tag’s current value as the value changes. The time is also updated as the
time changes.
You can also use literal strings and constants in embedded variables, or a
combination of both variable and literal strings and numbers.

Embedded variables can consist of:


• Numeric (analog or digital) tags, including both HMI and data server
tags
• Literal numbers (constants)
• String tags, including both HMI and data server tags
• Literal strings (static text)
• Tag placeholders.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 395


Chapter 24 Use embedded variables
• The time
• The date
For information about tag placeholders, see Use tag placeholders on page 403.

Where you can create You can create embedded variables in these editors:

embedded variables • Graphics. Use this editor to insert embedded variables in the captions
for graphic objects or in any text objects. For graphic objects with
multiple states, you can insert different embedded variables in each
state’s caption.
• Local Messages. Use this editor to insert embedded variables in local
messages.
• Information Messages. Use this editor to insert embedded variables in
information messages.
• Alarm Setup. Use this editor to insert embedded variables in alarm
messages.
• Display Settings. Use this editor to insert embedded variables in the title
bars of displays.

For more information about See


Graphic objects Set up graphic objects on page 339
On Top displays On Top displays on page 274
Local messages Local messages on page 285
Information messages Information messages on page 425
Alarms Set up alarms on page 103

Create an embedded
variable in a graphic To create an embedded variable in a graphic object’s caption
object’s caption 1. Open the graphic object’s Properties dialog box.
2. Click the tab containing the Caption box.
The Caption box is on the Label tab or the States tab, depending on the
type of object.
For text objects, use the Text box on the General tab.
3. Click Insert Variable.
4. Click the type of variable to insert.
5. Fill in the options in the dialog box that opens. For details about the
options, see Help.
Create an embedded
variable in an On Top To create an embedded variable in an On Top display’s title bar
display’s title bar 1. Open the Display Settings dialog box.
2. Select the Title Bar check box if it is not already selected.
3. Click Insert Variable.
4. Click the type of variable to insert.

396 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 24 Use embedded variables
5. Fill in the options in the dialog box that opens. For details about the
options, see Help.
Create an embedded
variable in a message To create an embedded variable in a message
1. In the Message column of the Local Messages, Information Messages,
or Alarm Setup editor, right click and then click Edit String.

2. Click Insert Variable.


3. Click the type of variable to insert.
4. Fill in the options in the dialog box that opens. For details about the
options, see Help.
Embedded variable syntax Embedded variables are case sensitive, and must use specific syntax to work.
Otherwise, the embedded variable is treated as a piece of text. Therefore, we
do not recommend creating and editing embedded variables manually.
Instead, use the Insert Variable and Edit Variable dialog boxes.

Numeric embedded variable Use numeric embedded variables to insert analog or digital tag values into
captions, title bars, and messages. You can use both HMI and data server tags.
syntax
You can also insert "literal" numbers to show a constant or to specify a tag
placeholder in the caption or message.
Numeric embedded variables use this syntax:
/*LN:# Tag_name Fill_character DP:#*/
where
• L (optional) indicates it is a literal (constant) number. This symbol
prevents a tag read. If you type a tag placeholder for the Tag_name, the
value of the placeholder is substituted from the parameter file or global
object parameter definition.
• N indicates it’s a numeric embedded variable.
• # indicates the number of digits.
• Tag_name is the tag to show; you can also type a literal number or tag
placeholder here.
• Fill_character is the fill character to use: NOFILL, ZEROFILL, or
SPACEFILL.
• # indicates the number of decimal places.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 397


Chapter 24 Use embedded variables

Examples: Numeric embedded variable syntax


To show the current value of a tag called Oven_temp, with 3 digits, no decimal
places, and no fill character, type this:
/*N:3 Oven_temp NOFILL DP:0*/
To show the constant 48, with 3 decimal places and 2 zeroes to the left of the
number (for a total length of 8 digits including the decimal), type this:
/*LN:8 48 ZEROFILL DP:3*/
At runtime the numeric embedded variable would look like this: 0048.000.

String embedded variable Use string embedded variables to insert string tag values into captions, title
bars, and messages.
syntax
You can also insert "literal" strings of static text. For example, you can type a
word or phrase, a tag placeholder, or a number. To control how constant
numbers are shown, use a literal numeric variable rather than a string
variable.
String embedded variables use this syntax:
/*LS:-# Tag_name SHOWSTAR*/
where
• L (optional) indicates it is a literal (static) string. This symbol prevents
a tag read. If you type a tag placeholder for the Tag_name, the value of
the placeholder is substituted from the parameter file or global object
parameter definition. The value cannot contain spaces.
• S indicates it’s a string embedded variable.
• - (optional). A minus sign (-) before the # indicates that if the string is
longer than the fixed number of characters, the right-most characters
will be shown.
• # indicates the number of characters if you select a fixed number of
characters; type 0 if you don’t want to use a fixed number.
• Tag_name is the tag to show; you can also type a literal string or tag
placeholder here. The string cannot contain spaces.
• SHOWSTAR (optional) specifies that if the string is longer than the
fixed number of characters, an asterisk (*) will be shown to indicate
the string is truncated. If you use the minus sign (-), the asterisk will be
shown as the first character at the left end of the string. Otherwise, the
asterisk will be shown as the last character at the right end of the
string.

Examples: String embedded variable syntax


To show the current value of a string tag called Blower_status, with a fixed
length of 20 characters, you would type this:

398 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 24 Use embedded variables
/*S:20 Blower_status*/
To show the literal string Oven temperature, type this:
/*LS:20 "Oven temperature"*/
To show the literal string 36.5, type this:

/*LS:3 36.5*/
To assign the tag placeholder #1, without a fixed string length, type this:
/*S:0 #1*/
To show the value of the string tag Conveyor_message, with a fixed length of
40, showing the right-most characters, with an asterisk to indicate if the
message is truncated, type this:
/*S:-40 Conveyor_message SHOWSTAR*/

Time and date embedded Use time and date embedded variables to insert the current time or date into
captions, title bars, and messages
variable syntax
Time and date embedded variables use this syntax:
/*Time_date_format*/

where
Time_date_format uses one of these character sequences:

These characters Specify this format


SD Short date
LD Long date
SDT Short date and time
LDT Long date and time
T Time
TSD Time and short date
TLD Time and long date

Example: Time and date embedded variable syntax


To show the time followed by the short date, you would type this:

/*TSD*/
A space is placed between the time and date when the embedded variable is
shown at runtime.

How embedded variables At runtime, this is how embedded variables are shown and updated:

are updated at runtime • Graphic objects and title bars — When a display containing a graphic
object or title bar that uses an embedded variable is open, the value of
the embedded variable is updated whenever a new tag value is read

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 399


Chapter 24 Use embedded variables
from the data source. For time and date embedded variables, the time
and date are updated as the system time and date change.
• Local messages — When a display containing a local message display
object is open, and the message the object is showing contains an
embedded variable, the value of the embedded variable is updated
whenever a new tag value is read from the data source. For time and
date embedded variables, the time and date are updated as the system
time and date change.
• Information messages — The value of the embedded variable is read
when the information message is first shown. It is not updated after
that.
If the message is printed, it is printed using the value the variable had
when the message was first shown. This value is retained if you shut
down and restart the application.
• Alarm messages — The value of the embedded variable is read when
the alarm occurs, and is shown in the message associated with the
alarm. It is not updated after that.
If the message is printed, it is printed using the value the variable had
when the alarm first occurred. This value is retained if you shut down
and restart the application.
How embedded variables If there is no valid data available for the embedded variable, the variable is
replaced with question marks (?). This could occur when a display first opens
are shown at runtime
and the data has not arrived yet, or when there is a problem that prevents
communication with the data source.
If a string or numeric embedded variable has been set up but no tag has been
assigned, the embedded variable is replaced with asterisks (*).

Numeric embedded The value shown for a numeric embedded variable depends on whether the
tag value is a floating-point number or an integer. Integer values are shown
variables as is. Floating-point values are rounded to fit the specified number of digits
for the variable.
For example, if the variable is set up to show 6 digits, 1234.56 is rounded to
1234.6. 1234.44 is rounded to 1234.4. The decimal counts as one of the digits.
For more information about how values are rounded, see How values are
rounded on page 86.
If the tag value, including the decimal point and minus sign, contains more
digits than specified for the variable, the numeric variable is replaced with
asterisks.
For example, if the variable is set up to show 6 digits, and the tag value is -
123456, the variable will be replaced with asterisks.
Literal numbers are shown using the same rules as numeric tag values.

400 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 24 Use embedded variables

Number formats The numeric variable uses the number format of the current application
language. For example, if the application language uses a comma for the
decimal symbol, the numeric variable uses a comma for the decimal symbol.
For information about using multiple languages, see Set up language
switching on page 173.

String embedded variables For string embedded variables that do not use a fixed number of characters,
the entire string tag value is shown, unless a null character is read. Nothing
after a null character is shown.
If a fixed number of characters is used, the variable shows the value of the tag
up to the number of characters specified, unless a null character is
encountered before the specified length. Nothing is shown after a null
character. If necessary, spaces are used to make up the required number of
characters.
Null characters have a hex value of 0. The null character indicates the end of
string input. It does not add to the actual string length.
If the string is longer than the specified number of characters, it is truncated
to fit the number of characters. If the SHOWSTAR option is used, an asterisk
(*) replaces the first or last character shown. If the embedded variable is set up
to show right-most characters, excess characters are truncated at the left end
of the string and the asterisk (if used) appears at the left. Otherwise, the right-
most characters are truncated and the asterisk (if used) appears at the right.
Literal strings are shown using the same rules as string tag values.

Time and date embedded For embedded variables that show both the time and the date, a space is
placed between the time and date when the embedded variable is shown at
variables runtime.

Time and date formats Time and date embedded variables use the time and date formats for the
current application language. For example, if you specify the short date
format, at runtime the display uses the short date format that the application
language uses.
For information about using multiple languages, see Set up language
switching on page 173.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 401


Chapter 25

Use parameters and global objects

This chapter describes how to:


• Use tag placeholders and parameter files or lists
• Create tag placeholders
• Create parameter files and parameter lists
• Use global objects
• Create global object displays and base objects
• Create, set up, and delete reference objects
• Use global object parameters
• Add controller instruction faceplates that connect to Logix 5000
processors
The topics in this chapter describe features of FactoryTalk View Studio that
can help you set up your applications more quickly by reusing similar groups
of objects and graphic displays.
• Tag placeholders, parameter lists, and parameter files allow you to use
the same graphic display with different sets of tags.
• Global objects allow you to use multiple instances of the same graphic
object and make changes to all of the objects at once.
• Global object parameters allow you to assign different sets of tags to
different copies of the object without breaking the link to the base
object, thus preserving the ability to update all copies of the object at
once.
• Controller instruction faceplates provide pre-configured graphic
displays that interact with the instructions in Logix 5000 processors.
Use tag placeholders Use a tag placeholder to mark where you want to insert a tag name or some
part of a tag name at runtime. A tag placeholder is a crosshatch character (#)
followed by a number from 1 to 500.
FactoryTalk View ME uses three methods for replacing a tag placeholder with
a tag name:
• Parameter files
• Parameter lists
• Global object parameters
To use the same graphic display with different sets of tags, use tag
placeholders with parameter files or parameter lists. Using tag placeholders
can be quicker than duplicating a display and setting up the objects in it to use
a different set of tags, especially when the display uses a lot of tags. Using

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 403


Chapter 25 Use parameters and global objects
parameter files or parameter lists also reduces the size of the runtime
application file.
You can use tag placeholders wherever you would normally assign a tag to an
object, including in expressions and embedded variables. You can also use tag
placeholders in the expressions you create to animate objects.
Tag placeholders can provide a way to use one graphic display to represent a
number of similar operations. For example, suppose you are creating displays
for a plant that cans corn and peas. The machinery used in both processes is
identical. Instead of creating two displays and specifying corn-related tags in
one display and pea-related tags in another, you can create one display and
not specify any tag names. Where a tag name is required, type a tag
placeholder.
Use parameter files or parameter lists to specify which tags to substitute for
which placeholders when a display opens at runtime. For information about
using parameter files, see Create parameter files on page 405. For information
about using parameter lists, see Create parameter lists on page 408.
You can also use tag placeholders with global objects. You can assign tag
placeholders to the connections for base objects, and to connections for
reference objects with the LinkConnections property set to False. For more
information about global objects, see Use global objects on page 410.
You can use tag placeholders in:
• The graphic displays that open when the application is first run.
Specify the graphic displays to open, and the parameter file or
parameter list to use with the graphic displays in the Startup editor.
• Graphic displays that are opened using Goto display buttons. Specify
the graphic display to open, and the parameter file or parameter list to
use with it, when you set up the button.
• Graphic displays that are opened using display list selectors. Specify
the graphic displays to open, and the parameter files or parameter lists
to use with them, when you set up the display list selector.
• The graphic display that opens when a logout button is pressed.
• The graphic display specified on the Project Settings Runtime tab
when auto logout is enabled.
• Displays specified on the Display tab of the Global Connections editor.
Use tag placeholders
To use tag placeholders with parameter files or parameter lists
1. In the Graphics editor, create graphic objects and assign tag
placeholders to the objects.
2. If you are using parameter files, create parameter files in the
Parameters editor for each set of tags that the display will use. In the
parameter files, specify which tags to substitute for which
placeholders.

404 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 25 Use parameters and global objects
3. In the Graphics editor, create Goto display buttons, logout buttons, or
display list selectors for opening the display containing tag
placeholders. Specify the appropriate parameter files in the graphic
object’s dialog box.
To use parameter lists, specify the tags for the lists in the dialog box.
4. If a startup display uses tag placeholders, in the Startup editor, specify
the parameter file to use with the startup display. To use a parameter
list, specify the tags for the list in the Startup editor.
For information about the Startup editor, see Create runtime
applications on page 193.
5. If auto logout is enabled, you have the option of opening a display on
logout. Specify the appropriate parameter file in the Runtime tab of
the Project Settings dialog box. To use a parameter list, specify the tags
for the list in the Project Settings dialog box.
For information about the Project Settings editor, see Help.
6. If the displays that will be changed remotely by global connections use
parameters, specify the parameter file or parameter list in the Display
tab of the Global Connections editor.
For information on global connections, see Set up global connections
on page 97.
Create tag placeholders A tag placeholder is the crosshatch character (#) followed by a number.
The tag placeholder can replace any part of a tag name, including folder
names. For example, you could create a parameter file specifying that the tag
placeholder #1=Folder1. You could assign the folder and a tag name to a
graphic object’s connection: #1\Tag1.
You can create tag placeholders in:
• The Connections tab of an object’s Properties dialog box.
• The Connections tab of the Property Panel.
• The Expression box in the Animation dialog box.
• A global object’s Parameter Definitions dialog box.
• Anywhere that you can insert an embedded variable. For information
about embedded variables, see Use embedded variables on page 395.

To create a tag placeholder


• Type the cross-hatch character followed by a number from 1 to 500 (no
space in between). For example, #1.

Create parameter files The parameter file specifies which tags to substitute for the placeholders on
the display, by assigning one tag to each unique placeholder on the display.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 405


Chapter 25 Use parameters and global objects
Create a parameter file for each set of tags that you want to use with the same
graphic display.
At runtime, the tag values that are shown depend on which parameter file is
used when the display opens. When you open the display, the tags specified in
the parameter file replace the tag placeholders.
Parameters can replace any portion of a tag address. For example, you can use
parameters to replace folder names.
Parameter files can list up to 500 tag placeholders. Use them when a large
number of tag placeholders are needed for a display. The text format of a
parameter file allows you to see and edit the placeholders easily. When
copying displays from one application to another, the related parameter files
must also be copied.

Use the Parameters editor Use the Parameters editor to create one or more files of tag placeholder
replacements. Each file is stored in the editor’s folder. You can open and work
on multiple parameter files at the same time.

For details about using the Parameters editor, see Help. To open the Help,
press F1 on your keyboard.

Example: Use a parameter file to replace tag placeholders


This example shows how to use a graphic display called Canning Overview
with two sets of tags, one for canning corn, and one for canning peas.
The Canning Overview display is opened from a graphic display called Main
Menu.
1. Create these sets of tags. You can use both HMI and data server tags.

406 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 25 Use parameters and global objects

Tag type Tag name Tag name


String Corn_Name Pea_Name
Analog Corn_Temp Pea_Temp
Analog Corn_Weight Pea_Weight
Analog Corn_Level Pea_Level

2. Create two parameter files, called Corn and Peas, containing these
parameters:
Corn Peas
#1=Corn_Name #1=Pea_Name
#2=Corn_Temp #2=Pea_Temp
#3=Corn_Weight #3=Pea_Weight
#4=Corn_Level #4=Pea_Level

3. In the Canning Overview display, assign tag placeholders to the Value


connections for these graphic objects:
This graphic object Uses this tag placeholder
String display #1
Numeric display 1 #2
Numeric display 2 #3
Bar graph #4

4. Use descriptive text to illustrate the objects on the display.


5. In the Main Menu display, create a display list selector for opening the
Canning display, with two states.
6. Assign the Corn parameter file to one state, and the Peas parameter
file to the other.
7. Call the captions for the states Corn and Peas, respectively.
At runtime, when the operator selects the Peas state on the display list selector
in the Main Menu, and presses the Enter key, the Canning Overview display
opens and shows the values of the Pea_ tags. When the operator selects the
Corn state, the values of the Corn_ tags are shown.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 407


Chapter 25 Use parameters and global objects
The Canning Overview display looks like this when the operator selects the
Peas state:

Create parameter lists You create parameter lists by selecting the tags as you set up the objects that
will open the displays that use them. The first tag in the list will replace
placeholder #1, the second tag in the list will replace #2, and so on. A
parameter list stays with the object when it is copied or duplicated, and with
the graphic display in which it is created, when the display is copied or moved.
Parameter lists can be used anywhere that parameter files can be used. The
parameter list option appears in:
• The States tab of the Display Selector object
• The General tab of the Logout button and Goto display button objects
• The Initial graphic displays option in the Startup editor
• The Runtime tab of the Project Settings editor
• The Display tab of the Global Connections editor
Parameter lists are defined in the object on the display. If the display or the
object is copied or imported to another application, the parameter list stays
with the object.

To use tag placeholders and parameter lists


1. In the Graphics editor, create graphic objects and assign tag
placeholders to the objects.
2. In the dialog box where the parameter list option appears, click on the
Browse button to open the Tag Browser.

408 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 25 Use parameters and global objects
3. Select the first tag or folder to add to the list and click OK. The tag or
folder name appears in the parameter list text box. At runtime, this tag
replaces placeholder #1.
4. To add another tag to the list, repeat steps 2 and 3. Each tag in the
parameter list box is separated from the previous tag by a comma. At
runtime, the second tag replaces placeholder #2, the third tag replaces
placeholder #3, and so on.

Example: Use a parameter list to replace tag placeholders


This example shows how to use a graphic display called Canning Overview
with two sets of tags, one for canning corn, and one for canning peas.
The Canning Overview display is opened from a graphic display called Main
Menu.
1. Create these sets of tags. You can use both HMI and data server tags.
Tag type Tag name Tag name
String Corn_Name Pea_Name
Analog Corn_Temp Pea_Temp
Analog Corn_Weight Pea_Weight
Analog Corn_Level Pea_Level

2. In the Canning Overview display, assign tag placeholders to the Value


connections for these graphic objects:
This graphic object Uses this tag placeholder
String display #1
Numeric display 1 #2
Numeric display 2 #3
Bar graph #4

3. Use descriptive text to illustrate the objects on the display.


4. In the Main Menu display, create a display list selector for opening the
Canning display, with two states.
5. In the first state, choose the parameter list option and select the Corn
parameter tags from the Tag Browser in this order: Corn_Name,
Corn_Temp, Corn_Weight, Corn_Level. In the second state, do the
same for the Peas tags.
6. Call the captions for the states Corn and Peas, respectively.
At runtime, when the operator selects the Peas state on the display list selector
in the Main Menu, and presses the Enter key, the Canning Overview display
opens and shows the values of the Pea_ tags. When the operator selects the
Corn state, the values of the Corn_ tags are shown.

Parameter passing You can use parameter files or parameter lists to pass (carry forward)
parameters from one display to other related displays that open from it. To
carry the same parameter forward to subsequent displays, assign the same tag

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 409


Chapter 25 Use parameters and global objects
placeholder (for example, #1), instead of a tag name in the parameter list or
parameter file field of the object in the related display.

Example: Use a parameter list to replace tag placeholders in linked


displays
This example uses PIDE faceplate displays to demonstrate parameter passing.
The main, or first level display, is called MAIN. It has a Goto display button
that opens a Logix_PIDE faceplate display. The faceplate has a Goto display
button that opens a Trend faceplate.
On the Main display, the Goto display button has the parameter list option on
the General tab selected, and a structure tag name, with a shortcut, selected
from the Tag Browser to represent #1: {::[PLC1]
Program:Fermenter_Temp.Tank_PIDE01}, for example.
When the button is pressed, the Logix_PIDE faceplate opens. The objects on
the faceplate have been set up to read the tags in the structure: #1.CV, #1.SP,
and so on. The objects replace the parameter #1 with the structure tag name
and then derive their values from the structure elements they have been set up
to read.
To carry the same parameters forward another level, the Goto display button
on the Logix_PIDE faceplate display has the parameter list option on its
General tab selected, and the parameter {#1} typed in. When this button is
pressed, the Trend faceplate opens, and its objects in turn replace their #1
parameters with the same structure tag name, and read their values from the
appropriate elements.

Use global objects FactoryTalk View global objects allow you to link the appearance and behavior
of a graphic object to multiple copies of that object. When you update the
original object, the changes are automatically applied to all the copies of the
object.
You create global objects in global object displays, in the Global Objects folder
of the Explorer window. The objects you create in a global object display are
called base objects.
You can copy or drag base objects into standard graphic displays. The copied
object is called a reference object. You can copy a global object into any
number of graphic displays, and multiple times into the same graphic display.
Global object displays (.ggfx) are stored in the default folder
\Users\Public\Public Documents\RSView Enterprise\ME\HMI
projects\Application Name\Global Objects

410 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 25 Use parameters and global objects
where Application Name is the name of your application.

Set up global objects


To set up global objects
1. In the Graphics editor, create a global object display. For more
information, see the next section.
2. Create graphic objects in the global object display. These are the base
objects. Set up their appearance, animation, and connections.
3. Copy or drag base objects into a standard graphic display. The copied
objects are reference objects. For more information, see Create
reference objects on page 412.
4. Edit the link properties of the reference objects as desired. For more
information, see Set up reference objects’ link properties on page 413.
Create global object You can create a global object display in the Global Objects folder, or create a
graphic display in the Displays folder and then add the display to the Global
displays and base objects
Objects folder. You can also add library displays to the Global Objects folder.
The objects you create in the global object displays are called base objects.

Create a global object


display To create a global object display
1. In the Graphics folder, right-click Global Objects, and then select New.
2. Create graphic objects on the display. These are the base objects.
Tip: You cannot use ActiveX objects as base objects. You cannot convert objects to
wallpaper in the global object display.
For information about creating graphic objects, see Use graphic
objects on page 291.
3. From the File menu, select Save, or click the Save tool .
4. In the Component name box, type a name for the display, and then
click OK.
The display is added to the list in the Global Objects folder.
Add a display or library to
the Global Objects folder To add a display or library to the Global Objects folder
1. In the Explorer window, in the Graphics folder, right-click the Global
Objects icon.
2. Select Add Component into Project.
3. Browse to and select the display or library to add, and then click Open.
The display is copied into the Global Objects folder, and given the file
extension .ggfx.
Any ActiveX objects are deleted. All other objects are converted to base
objects.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 411


Chapter 25 Use parameters and global objects
Tip: If you delete, remove, or rename a global object display, you break the links between
the base objects on the display and their reference objects. For more information about
breaking links, see Help.

Create reference objects FactoryTalk View global objects allow you to link the appearance and behavior
of a graphic object to multiple copies of that object. When the original base
object is updated, the changes are automatically applied to all the copies of the
object. The copies of the base object are called reference objects.
You can copy or drag base objects into standard graphic displays. Each copied
object becomes a reference object. You can also copy, drag, and duplicate
reference objects that you have already created to create more copies of the
base object.
Tip: Base objects can be group objects. This provides powerful template capabilities. When you add
or remove objects from the base object group, all the reference objects are automatically updated.

If desired, you can assign unique connections, animation, and size to the
reference object.

To create a reference object


1. Copy an object from a global object display to a standard graphic
display.
2. To assign unique connections, animation, or size to the object, double-
click the object to open the Property Panel.
3. For information about using the Property Panel, see Use the Property
Panel on page 314.
You can also create reference objects by adding a global object display to the
Displays folder. All the objects in the new display are reference objects.

Add a global object display


to the Displays folder To add a global object display to the Displays folder
1. In the Explorer window, in the Graphics folder, right-click the
Displays icon.
2. Select Add Component into Project.
3. Browse to and select the global object display to add, and then click
Open.
The display is copied into the Displays folder, and given the file extension .gfx.
All the objects are converted to reference objects.

Edit a reference object’s


base object To edit a reference object’s base object
1. Right-click the reference object, and then select Edit Base Object.

412 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 25 Use parameters and global objects
2. The global object display containing the base object opens, with the
object selected.
3. Make your changes to the base object.
4. All reference objects linked to the base object are updated.
To view the changes to the reference object, close the display containing the
reference object, and then reopen it. Or, toggle the object’s LinkSize property
on and off.

Set up reference objects’ FactoryTalk View global objects allow you to link the appearance and behavior
of a graphic object to multiple copies of that object. When the original base
link properties object is updated, the changes are automatically applied to all the copies of the
object.
The copies of the object are called reference objects, and they have the same
properties as the original base object. If desired, you can assign unique size,
connections, and animation to the reference object.
To assign unique properties to the reference object, use the Property Panel to
edit the following properties for the reference object:
• LinkSize — select False to set up the height and width separately for
the reference object. If LinkSize is set to true, when you try to resize
the reference object, it will snap back to its linked size.
• LinkConnections — select False to set up connections separately for
the reference object. Whether you use the base object’s connections, or
set up separate connections, the tags used count towards the tag limit
for the display.
You can assign tag placeholders to the connections for base objects,
and to connections for reference objects with the LinkConnections
property set to False.
• LinkAnimation—select Do not link to set up separate animation for
the reference object. To use the animation set up for the base object
but assign different expressions to the reference object, select Link
without expressions.
If you select Link with expressions, the reference object uses the
animation and expressions assigned to the base object.
Reference objects also have a property called LinkBaseObject, which specifies
the name and location of the base object to which the reference object is
linked. You cannot edit the LinkBaseObject property.

Change a reference object’s


link properties To change a reference object’s link properties
1. Double-click the object to open the Property Panel.
2. Make your changes to the link properties.
3. Specify the new size, connections, or animation for the object.
For information about resizing objects, see Resize objects on page 327.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 413


Chapter 25 Use parameters and global objects
For information about assigning connections to objects, see Assign tags and
expressions to an object’s connections on page 315.
For information about assigning animation to objects, see Animate graphic
objects on page 363.

Specify default link


properties for reference To specify default link properties for reference objects
objects 1. From the Edit menu, select Global Object Defaults.
2. Specify the new default values.
3. Click OK.
The defaults are used for any new reference objects you create. You can still
edit the properties for individual objects separately.

Break the link to a base


object To break the link to a base object
• Right-click the reference object, and then click Break Link.
The reference object becomes a regular object. You can edit all of its
properties. However, you cannot restore the connection to the base object.

Delete the base object If you delete a base object or a global object display containing base objects,
any reference objects that are linked to the deleted base objects are broken. A
broken reference object is displayed as a red square with an X through it. You
cannot edit broken reference objects.

Repair a broken reference


object To repair a broken reference object
• Recreate the base object with the same object type and name as before,
on the same display as before.
Use global object Global object parameters are parameters that you can assign to global objects.
You can use a global object parameter to assign different tags or sets of tags to
parameters
each reference object without breaking the link to the base object. You can
then make changes to the base object and all the associated reference objects
at the same time.
Use global object parameters when more than one instance of a global object
is used on a display. For example, the Logix_PIDE global object display
contains a grouped object composed of other grouped objects. The objects’
connections are set up with tags and expressions that use values from a set of
Logix 5000 tags. When you create multiple reference objects from this base
object, each reference object can use a different set of Logix 5000 tags. The
global object parameters you assign to the base object allow you to do this,
because you are using a placeholder instead of a specific backing tag (a
backing tag is a path to a folder of tags; it is also known as a structured tag). If

414 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 25 Use parameters and global objects
you then change, add, or remove a tag or expression in the base object, the
same change is made to all the reference objects.
If you don’t use global object parameters, you can still assign different tags to
different reference objects by changing the reference object’s
LinkConnections property to False and the LinkAnimations property to Link
without expressions.
The global object parameter takes the same form as a regular parameter. The
parameter can be the placeholder for an individual tag or for a folder of tags.
For example, #1 could be a placeholder for the path to the folder containing
the PIDE tags assigned to the global object.
When you set up the base object, specify the global object parameters to use
with the object. You can provide a description of each parameter to remind
you or another application designer of the type of value to assign to the
parameter on the reference object. Then assign specific values to each
parameter for the reference object. You can assign numeric or string
constants, tags, or backing tags.
You can create up to 1000 global object parameters.

Difference between global Global object parameters allow you to assign different values to different
instances of the same placeholder. For example, each reference object on the
object parameters and display might have the placeholder #1. Using regular parameter files, you
regular parameters could only assign one value to #1, and this would apply to all objects in the
graphic display. With global object parameters, you can assign a different
value to #1 for each object that uses the placeholder #1.
If a placeholder is defined in a global object parameter for an individual object
and defined in a parameter file, the definition assigned to the object takes
precedence.

Use global object To use global object parameters with a group object, the parameters are
defined at the group level, not at the level of individual objects. Thus the
parameters with group definition applies to each object within the group. You can assign as many
objects parameters as desired to the group. For example, you might assign #1 to some
members of the group and #2 to other members of the group. If you create a
global object parameter definition for an object and later group the object, the
definition is deleted. In addition, if you create a global object parameter
definition for a group and then ungroup the object, the definition is deleted.
Values are assigned to the global object parameters at the group level as well.
You cannot assign separate values to individual objects in the group.

Use global object


parameters To use global object parameters
1. On the global object display, assign parameters to the base objects and
add definitions to the parameters. For details, see the next section.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 415


Chapter 25 Use parameters and global objects
2. On the standard graphic display, select the reference object and specify
the value to use for each parameter. For more information, see Create
reference objects on page 412.
Specify global object
parameters for the base To specify global object parameters for the base object
object 1. Create placeholders in each place where you want to use a global object
parameter. You can create the placeholders anywhere a tag or
expression is required.
You can also type placeholders in embedded variables by using a literal
string embedded variable. For information about embedded variables,
see Use embedded variables on page 395.
2. Right-click the global object or grouped global object, and then select
Global Object Parameter Definitions.

3. (Optional) Type a description for each parameter.


For details about using the Global Object Parameter Definitions dialog box,
see Help.

Specify the parameter


values for the reference To specify the parameter values for the reference object
object 1. Right-click the reference object or grouped reference object, and then
select Global Object Parameter Values.

416 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 25 Use parameters and global objects
2. Specify a value for each parameter. The value can be a tag, backing tag,
or numeric or string constant. Numeric constants are treated as
strings of text.
Controller instruction Controller instruction faceplates are pre-configured graphic displays and
faceplates global object displays that interact with Logix 5000 processors.
Controller instruction faceplates contain graphic objects that display values
from a Logix 5000 processor and allow operators to interact with the
processor. You can use the faceplate graphic displays as stand-alone displays,
or copy the faceplate objects into other graphic displays. If desired, you can
edit the objects in the faceplates. For example, you might want to add your
company logo or change the colors used in the faceplates.
To use a controller instruction faceplate, you must add it to your application
and specify the path to the Logix 5000 processor instructions used by the
faceplate. The faceplates are set up so that you can specify the path to the
instructions using parameter files. For more information, see the Help for the
faceplates, accessible from the Add Controller Instruction Faceplates dialog
box.
FactoryTalk View Studio comes with sets of faceplates that work with these
Logix 5000 instructions:
• Enhanced PID (Logix_PIDE)
• Discrete 2-State Device (Logix_D2SD)
• Discrete 3-State Device (Logix_D3SD)
• Totalizer (Logix_TOT)
• Enhanced Select (Logix_ESEL)
• Alarm (Logix_ALM)
• Ramp/Soak (Logix_RMPS)
• PhaseManager (Logix_PhaseManager)
The name in parentheses is the name of the main graphic display and global
object display. Other displays in the set are named beginning with this name,
followed by a segment describing the purpose of the subdisplay. For example,
Logix_ALM has two subdisplays called Logix_ALM_Config and
Logix_ALM_Status. When you add controller instruction faceplates, any
graphic images associated with the faceplates are added to the Images folder

Add controller instruction


faceplates to an application

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 417


Chapter 25 Use parameters and global objects

To add controller instruction faceplates to an application


1. In the Explorer window, right-click the HMI server, and then select
Add Controller Instruction Faceplates.

The Add Controller Instruction Faceplates dialog box opens.


2. Select the faceplates to add.
For details about selecting options in the dialog box, see Help.

418 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 26

Set up data logging

This chapter describes:


• Steps for setting up data logging
• Data log files
• Data log models
• How to change the data log model used at runtime
• How to show data logs using the trend graphic object
• Problems with data logging
Set up data logging
To set up data logging
1. In the Data Log Models editor, set up a data log model that specifies
how many log values to store, the conditions that trigger data logging,
where to log data, and which tags to monitor.
2. In the Startup editor, turn on data logging by selecting the Data
logging check box. Also use this editor to specify the data log model to
use at runtime. See Create runtime applications on page 193.
3. In the Graphics editor, create a graphic display containing the trend
graphic object, and set up how the object looks, which tag values to
show, the start time, and the time span for the data. Also specify the
name of the data log model to use.
Data log files As soon as the application starts running, FactoryTalk View begins logging
tag values to the data log files. When the maximum number of data points
have been logged, the oldest data is deleted to make room for the new data.
FactoryTalk View supplies data from the log files to the trend object for the
requested tags and time span.
The data log files are retained when you restart an application after a
shutdown or power loss. You can delete the log files from the runtime
computer at application startup.
Use data logging to keep a permanent record of tag data. You can record tag
data as tag values change, or on a periodic basis (for example, every minute).
For information about deleting the log files, see Delete log files on the runtime
computer on page 214.

File names FactoryTalk View creates two data log files:


• Data Log Model Name.log
• Data Log Model Name.tag

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 419


Chapter 26 Set up data logging
You’ll need this information if you log to a custom path and want to delete the
log files manually.

Data Log Models A data log model defines which tags to log data for, as well as how and where
the data is logged.
You can set up multiple data log models, but you can run only one data log
model at a time. For information about running a different data log model,
see Change the data log model used at runtime on page 422.

Create Data Log Models Use the Data Log Models editor to create one or more data log models. Each
data log model is a file stored in the editor’s folder. You can open and work on
multiple models at the same time.

For detailed information about the options in the Data Log Models editor, see
Help.
Each data log model has a unique name, and an optional description.
You can log a maximum of 1,000,000 points for version 7.00.00 or later, and
you can log 300,000 points for release versions earlier than 7.00.00. The
default is 1000. When the maximum number of data points have been logged,
the oldest data is deleted to make room for the new data.

Data storage locations You can store data log files in any one of these locations:
• On the runtime computer
• On another computer on the network
• On a memory stick for a MobileView terminal
• On an SD card for a PanelView Plus 7 or PanelView Plus 6 terminal

420 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 26 Set up data logging
• On a compact flash card for a PanelView Plus, PanelView Plus
Compact, or PanelView Plus CE terminal
If the logging destination is unavailable for any reason, for example, the card
is removed or the network drive becomes unavailable, data logging stops. It
does not restart until you restart the application.

Log to a network location To log data to a network location, the network drive must be shared, and the
runtime computer must be logged in to the same domain as the computer on
the network. To do this, the user must have access rights for the domain.
The PanelView Plus 7, PanelView Plus 6, PanelView Plus, PanelView Plus
Compact, or PanelView Plus CE terminal cannot be part of a domain.
However, you can verify that the user who is logged into the terminal is on a
user list that is part of a domain.
For more information about logging in to a Windows domain or
authenticating users, see Log in to the application on page 230.

Data logging methods There are two methods for triggering data logging. You can set up logging so
tag values are logged:
• Periodically (periodic logging)
• Only when a tag value changes (on-change logging)
Log periodically Periodic logging is used to take a snapshot of all tag values at a particular
point in time. Tag values are logged even if there has been no change.
You cannot change the periodic log rate at runtime.

Log on change On-change logging is used to log only tags whose values have changed.
For HMI tags, before logging occurs, the change must equal a specified
percentage of change in the tag value. The percentage is based on HMI tags’
minimum and maximum values as set up in the Tags editor. Only the tags
that change by the specified percentage are logged. If you specify a percentage
of 0, all changes are logged.
If a tag does not have a minimum or maximum attribute (for example a data
server tag in Logix 5000), when you specify on-change logging, all changes are
logged for that tag. You don’t need to specify a percentage.

Use a heartbeat rate You can also specify a heartbeat rate, to log values at specified times even if no
tag value changes have occurred. The heartbeat ensures that the data in the
log file is current. The heartbeat is also a good way to ensure that data logging
is working and acquiring valid data.
The heartbeat cannot be less than the maximum update rate, which is the rate
at which data servers send tag values to FactoryTalk View.
If you specify a heartbeat of 0, the heartbeat is not used.

Tags in the data log model The data log model can contain up to 100 analog or digital tags, including
both HMI and data server tags.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 421


Chapter 26 Set up data logging
You cannot use string tags, array tags, tag placeholders, parameters, or
expressions in your data log model.

Delete tags from the model If you delete a tag from the data log model, previously logged data for the tag
is not accessible unless you add the tag back to the model.

Change the data log model Your application can run only one data log model at a time. Follow this
procedure to switch data log models.
used at runtime

To run a different data log model


1. Shut down the application.
2. Start FactoryTalk View Studio and open the application.
3. In the Startup editor, specify the new data log model.
4. Create the runtime application. See Create runtime applications on
page 193.
5. Transfer the runtime application to the runtime platform.
For information about transferring applications to:
• A personal computer, see Run applications on a personal computer
on page 199.
• A MobileView, PanelView Plus 7, PanelView Plus 6, PanelView Plus,
PanelView Plus Compact, or PanelView Plus CE terminal, see
Transfer applications to a MobileView, PanelView Plus 7, PanelView
Plus 6, PanelView Plus, PanelView Plus Compact, or PanelView Plus
CE terminal on page 217.
6. Run the new application.

Show data logs using the You can use the trend graphic object to show the data that you have logged. At
runtime, when the operator opens a graphic display containing a trend, the
trend graphic object trend shows values from the data log file for the data log model that is
running. The data log model specifies which data to collect in the data log file.
In addition to showing historical values from the data log file, trends can
show current values for the tags in the model. Trends can also show current
values for tags or expressions that are not in a data log model. For more
information about trends, see Set up trends on page 433.

Problems with data logging Problems with data logging occur under these circumstances:
• When your application starts at runtime, if any of the tags specified in
the current data log model do not exist, an error message is sent to
FactoryTalk Diagnostics.
• If the data log file is corrupted or invalid, the file is deleted and
recreated, and an error message is sent to FactoryTalk Diagnostics.
• If logging to a folder on a networked computer, and the runtime
computer is not logged in to the Windows domain of the network

422 Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020


Chapter 26 Set up data logging
computer, the log folder cannot be created. An error message is sent to
FactoryTalk Diagnostics.
• If logging to an invalid path, the log folder cannot be created. An error
message is sent to FactoryTalk Diagnostics. One of the reasons that the
path might be invalid is that the top-level folder of the path is not
shared.
• When the application starts, FactoryTalk View checks whether there is
disk space to store the data log model’s data. If there is not enough
space, an error message is sent to FactoryTalk Diagnostics and data
logging does not start.

Rockwell Automation Publication - VIEWME-UM004P-EN-E - September 2020 423

You might also like