Skip to main content

Index In List

Uncontrolled node

Overview​

Find the first position of a value in a list.

Find the first occurrence of a value in a list. Positions start at zero, so the first item has index 0.

This node is evaluated when another node needs its output. It has no run or done event.

Inputs​

InputTypeDescription
listListThe list to search.
valueDataThe value to find. Use the same type as the list items.

Outputs​

OutputTypeDescription
outputNumberZero-based index of the first match, or -1 if not found.
foundBooleantrue when a match exists; false for no match, an empty list or a non-list input.

Matching values​

Text matching is case-sensitive. The number 3 is different from the text "3". Objects and nested lists are not compared field by field, so separately constructed objects with identical contents do not count as a match. For records, map out the field you want to search first.

Example​

For list: ["red", "blue", "blue"] and value: "blue", the outputs are output: 1 and found: true.

For value: "green", the outputs are output: -1 and found: false. Use found for a condition rather than testing the index as a Boolean: index 0 is a valid match.