GetElementByIndex

Version 1.8

function GetElementByIndex<T>(array: T[] | string | null, arrayIndex: number | null): T | any

Version 1.10

function GetElementByIndex(ctx: Required<TcHmi.Context>, arraySymbol: TcHmi.Symbol | null, arrayIndex: number | null): void

The function GetElementByIndex returns the value of a certain array index of a binding.

Parameter

Name

Type

Description

ctx

Available from version 1.10

Required<TcHmi.Context>

Context object

Does not need to be specified by the user when used in a trigger or function expression. In this case the transfer and the evaluation is done by the corresponding parser.

Is used by the caller to indicate success or failure to the framework during execution.

If the function is used directly in JavaScript/TypeScript, the context object must be passed in the call and evaluated if necessary.

arraySymbol

Version 1.8

T[] | string | null

Version 1.10

Symbol

A binding to the symbol of an array.

index

number | null

The index of the array for which the value is to be returned.

Return value

Type

Description

Version 1.8

any

Version 1.10

void

Version 1.8

The value that is stored in the position of the index in the array.

Version 1.10

No return value.

The result or error information is communicated via corresponding callback functions in the context object.

NuGet package: Beckhoff.TwinCAT.HMI.Functions

GetElementByIndex 1:

NuGet packages are available from version 1.12.

GetElementByIndex 2:

Available from 1.8