
23 • Use expressions
23-7
• • • • •
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:
How string operands are evaluated
String operands are evaluated by case and by alphabetical order. Lower case 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.
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 run time.
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
false
serial_no == “ST009”
true
NE, <> not equal tag1 <> tag2
true
serial_no <> “ST011”
true
LT, < less than tag1 < tag2
true
serial_no < “ST011”
true
GT, > greater than tag1 > tag2
false
serial_no > “ST011”
false
LE, <= less than or equal to tag1 <= tag2
true
serial_no <= “ST011”
true
GE >= greater than or equal to tag1 >= tag2
false
serial_no >= “ST011”
false
Commentaires sur ces manuels