Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »



Function: getElement()

Returns the item at a specified index position within an Array or Recordset.

Syntax

  1. getElement(set, index)
  2. set[index]
  3. set.index
ArgumentTypeDescription
setArray or Recordset

The array or recordset to get the result from.

indexInteger

The position of the item in the array to be returned.

If index is not a valid entry, the function returns:

  • either _NULL
  • or the specified default_value.

An invalid index is outside the array or recordset. Index positions start at 1, so 0 is an invalid index. 

default_valueany type

Optionally, a default value to return instead of _NULL if the index is not valid.

If there is only one item in the set, getElement treats it as the first item in an array.

Examples

getElement(["Red", "Green", "Blue"], 2)

Returns the 2nd element, "Green".


getElement(["Red"], 1)

Returns the element, "Red".


["Red", "Green", "Blue"].3

Returns the 3rd element, "Blue".


["Red", "Green", "Blue"].8

Returns _NULL, as there is no element at position 8.


["Red", "Green", "Blue"].8

OR you will get the default value provided


getElement(["Red"], 1)

Returns Red, treating it as if it is the first element in an array

getElement(["Red"], 2)

Returns either _NULL or the default-value, because there is no eleme


[].1

Returns _NULL.


in.CustomerNames

returns a list of customer names that exist on the records on the in pipe. Please note that only recordsets can be indexed in this way, and lists must be accessed using numerical indices, as above.


in.$attributeName

will return the same as in.CustomerNames, if $attributeName is set to the string value $attributeName = "CustomerNames".

See Also

  • No labels