Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

ArgumentTypeDescription
setArray or Recordset

The Array or Recordset to get the result from.

indexIntegerThe position of the item in set to be returned.
default valueany type

Specify a default value to return instead of the item itself.

PhixFlow also returns this value:

  • ask for a position not in the array or recordset beyond the list you get Null or default
  •  instead of -NULL if the requested element does not exist.

If not specified

If index is not a valid entry the function will return _NULL.

You expect get element to work on a list/array. Ask for something outside the array. Andy error but he got null... there is nothing at position 4

If you provided a default value

This default value is also used in the case where you ask for element 1 of an object that isn't a list.  If you provide a default value then that is returned otherwise it just returns the object itself


If you dont; provide a list in get element, it doesnt fall over if you only ask for index 1

If you provide not a list... index 1 returns the thing..... pretends it it is a list....pretends its a list of 1 object...

Examples

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

...

Returns _NULL, as there is no element at position 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

getElement ([1,2,3],4)
getElement ([1,2,3],0)

but currently just return null.


[].1

Returns _NULL.


in.CustomerNames

...