beautypg.com

Formatting expressions, Using the = (equal) command – Rockwell Automation 9301 Series RSView32 Users Guide User Manual

Page 519

background image

14–6

RSView32 User’s Guide

Formatting expressions

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

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

When you’re working in the Animation dialog box in the Graphic
Display editor, type Ctrl-Tab to insert a tab in the expression.

Example: Formatting 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

Using the = (Equal) command

You can type an expression as a command using the following syntax:

3.

[&] <tag_name> = <expression> where:

[&]

Forces the command to be executed asynchronously,
which makes the command faster.

<tag_name>

The name of an analog, digital, or string tag that will
store the result of the expression.