Skip to main content

Index In List

Uncontrolled node

Overview

The Index In List node searches for a specific value within an array and returns its position. It uses strict equality comparison (similar to JavaScript's indexOf method) to locate the first occurrence of the value in the list.

If the value is found, the node outputs its zero-based index and a found flag set to true. If the value is not present in the list, it outputs -1 for the index and false for the found flag.

Use with other list nodes

This node pairs well with the Get Value node to retrieve items by index, or with If nodes to branch logic based on whether an item exists in a list.

Inputs

InputTypeDescriptionDefault
ListArrayThe list or array to search through.-
ValueAnyThe value to search for in the list. Uses strict equality comparison.-

Outputs

OutputTypeDescription
OutputNumberThe zero-based index of the value in the list. Returns -1 if the value is not found or if the input is not a valid array.
FoundBooleantrue if the value exists in the list (index >= 0), false otherwise.

Runtime Behavior and Defaults

  • Uncontrolled: This node runs automatically whenever its inputs change. It does not require an event trigger.
  • Empty Lists: If the input list is empty or not a valid array, the node returns -1 for the index and false for found.
  • First Match Only: If multiple items in the list match the value, only the index of the first occurrence is returned.
  • Strict Equality: The comparison uses strict equality (===), meaning type and value must match exactly.

Example Usage

Scenario: Check if a user's email exists in a list of approved emails and get its position.

  1. Connect a List node (or any node outputting an array) to the List input.

  2. Connect a Text node containing the email to search for to the Value input.

  3. The node will automatically output:

    • If found: output = 2 (for example), found = true
    • If not found: output = -1, found = false
  4. Connect the Found output to an If node to branch your workflow based on whether the email exists in the list.