Operators

Operators in expressions are symbols that not only let you connect data values together, but also determine how the values work together to convert the data source. Mathematical and relational operators are supported.

NOTE: Boolean and concatenation operators are not yet available.

To access these operators, on the Edit Expression tab of the Expression Builder, select the operator buttons you want to use. You can also add numerals to your expressions with the number buttons or you can enter the numbers manually (using your keyboard).

In addition to these operators, the Expression Builder allows you to select a set of functions. To enter a function, select a function from the list and click the Function button. The following table summarizes the available functions and their syntax. All trigonometric functions require values entered in radians.

Function

Description

Syntax

ABS

Absolute value of number.

ABS (number)

ACOS

Arccosine of number.

ACOS (number)

ASIN

Arcsine of number.

ASIN (number)

ATAN

Arctangent of number.

ATAN (number)

COS

Cosine of number.

COS (number)

EXP

Natural anti-log of number.

EXP (number)

INT

Integer value of number.

INT (number)

LOG

Natural log of number.

LOG (number)

LOG10

Base 10 log of number.

LOG10 (number)

SIN

Sine of number.

SIN (number)

SQRT

Square root of the number.

SQRT (number)

TAN

Tangent of number.

TAN (number)

The operators and their associated syntax are described in the following sections with examples of each.

Mathematical Operators

Mathematical operators allow you to add, subtract, multiply, and divide two or more values. Using these operators, you can create a mathematical expression. You can also change the operator's order of precedence in the mathematical expression by using parentheses.

Mathematical expressions are evaluated by first determining the data value on each side of the mathematical operator and then performing the mathematical operation. For example, consider the following expression:

5+analog1

...where analog1 is an alias for the data source ds://webserver1/Historian1/analog1.F_CV. When this expression is evaluated, the current value of the Historian tag analog1 is determined and then it is added to 5. If the value is 50, for example, the expression evaluates to 55.

Because of the way the expressions are evaluated, the values on both sides of an operator must both be either a numeric value or a string, but not one of each. You cannot, for example, add the descriptive string "Pump1 for Main Water Supply" to the data source ds://webserver1/Historian1/analog1.F_CV. However, you can add that same string to the data source ds://webserver1/Historian/analog1.a_DESC.

Syntax: Mathematical Operators

The syntax for each mathematical operator is provided in the following table:

Operator

Syntax

+ (addition)

value1 + value2

- (subtraction)

value1 - value2

* (multiplication)

value1 * value2

/ (division)

value1 / value2

( (left parenthesis)

(value1 + value2) * value3

) (right parenthesis)

(value1 + value2) * value3

Example: Mathematical Operators

Consider the following expressions:

Expression

Value

5+analog1

The current value of analog1 plus 5. If analog1 is 100, the expression evaluates to 105.

analog1*OPC1N35

The product of the tag analog1 and the OPC item N35. If the tag's value is 100, and the item's value is 50, the expression evaluates to 5000.

Relational Operators

Relational operators allow you to compare two values to determine how they relate to each other.

Syntax: Relational Operators

The syntax for relational operators is shown in the following table.

Operator

Syntax

= (equal to)

value1 = value2

<> (not equal to)

value1 <> value2

> (greater than)

value1 > value2

< (less than)

value1 < value2

>= (greater than or equal to)

value1 >= value2

<= (less than or equal to)

value1 <= value2

Example: Relational Operators

Relational operators are commonly used in boolean conditions to determine if part or all of an expression is true or false. An example:

analog1= 50

When this expression is evaluated, the value of the left side of the operator is compared to the right side. If the two values match, the condition is true. Otherwise, it is false.

You can compare any data value to any other data value, and when evaluated, a true or false will be returned as the value of the expression. For example, consider the following conditions:

Condition

Value

3>1

TRUE

5 = "Enter tagname"

FALSE

analog1 = 100

TRUE, if the current value of analog1 is 100.

analog1 >= OPC1N35

TRUE, if the current value of analog1 is greater than OPC1.N35.