ARRAYELEMENT

Some database items, such as array variable items, have an array of values rather than one value. You can use the ARRAYELEMENT function in an expression to access any of the values in an array, for example, you could use the ARRAYELEMENT function to access the third value in an array of six values.

Function Name

ARRAYELEMENT

Description

Returns a value from a specified element in an array.

Arguments

ARRAYELEMENT("Tag", <ELEMENT NUMBER>)

Where:

"Tag" represents a tag for an array. The tag has to be for an array in an available database (see Tags)

<ELEMENT NUMBER> is the number of the array element that contains the value that is to be returned, for example, 4 will return the value in element 4 of the array. Do not include the angle brackets <>.

Arrays are usually 0 based, so 0 will be the first element, 1 the second element, 2 the third element and so on.

Returns

Variable - the type of value returned is dependent on the type of value in the defined element of the array. For example, if the element contains a string value, a string value is returned by the ARRAYELEMENT function.

Example:

An ST Program is used to write six values to a Float Array database item named ‘PCR67F’. One of these values - the value in the third element - is required as an input for a text box animation. The text box is configured to have a Value animation that uses the ARRAYELEMENT function in its expression:

ARRAYELEMENT(".PCR67F", 2)

This returns the value in the third element of the ‘PCR67F’ Array Variable item. As the text box is animated to display the value that is returned by its Value animation, it means that the text box will display the value of the third element in the ‘PCR67F’ Float Array.

Further Information

Array Database Items: see Using Variables to Store Data Values in the Geo SCADA Expert Guide to Core Configuration.


Disclaimer

Geo SCADA Expert 2019