Understanding the Basics of Expressions

There are 2 types of expression in Geo SCADA Expert:

Expressions can contain tags that are used to obtain values from a database. For example, an expression can contain a tag that represents the CurrentState value of a database point.

Expressions can 'call' various built-in functions. For example, you can include the REGISTRY function in an expression to read a value that is stored in the registry. Likewise, you can use the EXISTS function in an expression to check whether an item that is referenced in an argument exists in the database before returning that item's value. If you needed an expression to calculate the largest value in a list of values, you would include the MAX function in your expression. For more information on the available functions, see Functions.

Any whitespace that is included in expressions is skipped when those expressions are parsed. The exception to this is any whitespace that is included with a string literal, a time/date literal, or a tag. Within this guide, we tend to include whitespace between arguments, operands, and examples in order to aid readability.

Example:

The following expression is used to animate the color of a shape on a Mimic so that it changes color according to the value of an analog point:

IIF (".AI1.CurrentValue">=60, RGB(255,0,0), RGB(0,255,0))

Where:

  • IIF is a function that returns one of two values depending on the result of a comparison
  • ".AI1.CurrentValue" is the tag that is used to obtain the current value of a point named 'AI1'. (The 'AI1' point is stored in the same group as the Mimic in this example)
  • >=60 compares the value of the point with the value 60. If the point value is 60 or above, the color of the shape is set to the color defined by the first RGB function. If the point value is below 60, the shape is set to the color defined by the second RGB function
  • RGB(255,0,0) is a function. The expression contains 3 numbers that represent the color values (Red, Green, and Blue) for the color that is returned (in this case, red)
  • RGB(0,255,0) is a function. The expression contains 3 numbers that represent the color values (Red, Green, and Blue) for the color that is returned (in this case, green)
  • ) closes the arguments for the IIF function.
  • So, when the value of the 'AI1' point is below 60, the shape on the Mimic is green; when the value is 60 or above, the shape is red.

Now that you have a basic understanding of the purpose of expressions and know something about their syntax, you can start thinking about creating your own expressions. Before you start your own expressions, you should familiarize yourself with the Grammar for Expressions.

We also recommend that you refer to the following sections:


Disclaimer

Geo SCADA Expert 2022