# List Item At Index/Sublist

This function is used to extract a single item or a sublist from a list in a field or named variable. The result is saved to a specified variable or named variable.

The index field takes the form of index or first index,last index. The indexes are zero based and count from the left. ie. 0 is the first element, 1 is the second, etc. Negative indexes count from the right. ie. -1 is the last element, -2 is the second to last element, etc. An invalid index will result in the destination variable being set to empty.

> for a list of A,B,C,D,E
> an index field of 3 --> D
> an index field of 2,-1 --> C,D,E
> an index field of 1,-2 --> B,C,D

The first or only index must resolve to be greater than zero and less than the number of list components. The optional last index must resolve to be greater than or equal to the first index and less than the number of list components.

If the list delimiter resolves to be empty when the action is executed, it is defaulted to \~. Note that when extracting a sublist, the same delimiter is used for the result.

All text fields may contain any of the escape sequences described in Escape Sequences. Note that the optional comma must be in the supplied index field. ie. the comma cannot be extracted as a result of unescaping at run time. Remember that an empty index field component after unescaping is treated as 0.

When running stepwise the function is only performed once if the source list or destination is a named variable.

The action test state will be set to true if an item was extracted, otherwise false.