Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

TableLookup

  • Last UpdatedJul 18, 2023
  • 1 minute read

Searches for a value in a table, and returns the position (offset) of the value in the table. Be aware that the first item in a table is offset 0 (zero), the next item is offset 1, etc.

Note: This function only supports arrays declared in Cicode and not variable tag arrays.

Syntax

TableLookup(Table, Size, Value)

Table:

The table to search. The table needs to be an array of real numbers. Must be a Real type variable.

Size:

The maximum number of items in the table.

Value:

The value to locate.

Return Value

The offset to the table value, or -1 if the value does not exist.

TableMath

Example

REAL Levels[5]=10,15,50,100,200;

Variable=TableLookup(Levels,5,50);

! Sets Variable to 2.

Variable=TableLookup(Levels,5,45);

! Sets Variable to -1.

See Also

Table (Array) Functions

In This Topic
TitleResults for “How to create a CRG?”Also Available in