LOOKUP

The LOOKUP function returns the nth expression from a set of expressions.

Function Name

LOOKUP

Description

Returns the nth expression from a set of expressions.

Arguments

LOOKUP( Index, Value 1, Value 2, ... )

Where:

  • Index is a numerical expression that defines which of the input values are returned. The range is 1 to n. The Index is an INTEGER or REAL, see Number (Integer or Real).
  • Value 1, Value 2 and so on are a list of expressions that define the possible values that can be returned by the function.
Returns

The nth expression from a set of expressions.

The data type of the returned value varies according to the data types of the inputs.

Example:

A Mimic item is animated to be a different color when a 2 bit digital point changes state. There needs to be a separate color for each of the point's 4 states.

The Mimic item has its FillColour property animated by the following expression:

LOOKUP(".2 Bit Digital.CurrentState"+1, RGB (255,0,0), RGB (0,255,0) RGB (0,0,255), RGB (255,255,0))

This means that when the point is in state 0, the Mimic item will be red (RGB 255,0,0). The +1 at the end of the point reference is needed as the arguments in an expression are numbered 1, 2, 3, 4 whereas the states of the point are numbered 0, 1, 2, 3.

When the point is in state 1, the Mimic item is green. When the point is in state 2, the Mimic item is blue, and when the point is in state 3, the Mimic item is yellow.

The same effect can be achieved by using the CurrentStateColour property.


Disclaimer

Geo SCADA Expert 2020