Skip to content

Get Data By Index

Get Data By Index is a simple tool that lets you pull out a single piece of information from a larger set of data. Think of it like looking up a name in a phone book and then choosing the third phone number that appears. It works with both lists (arrays) and dictionaries (objects), and you can even go into nested structures using dot notation.

How it Works

The component takes the data you feed into it and looks for the value that matches the Key you provide. If the value is a list, it then selects the element at the position you specify with Index. If you leave Index empty, the component will instead return the numeric position of each item in the list (0, 1, 2, …). Negative numbers are allowed, so -1 gives you the last item, -2 the second‑to‑last, and so on. The result is sent out as a new data object that can be used by other components in your workflow.

Inputs

  • Data: Data to process.
  • Key: Specify the key to extract a value from the input data.
    • To extract an item by specific value: Provide the key’s name. Use dot notation to access nested data (e.g., property.sub_property).
    • To get the item’s index: If you leave this field empty, it will return the numerical position (index) of each item within the input list (0, 1, 2…).
  • Index: Index of the element to retrieve. Supports negative indexing (e.g., -1 for the last element).

Outputs

  • Data: The extracted item or the index positions, depending on the inputs. This output can be fed into other components to continue processing or to trigger actions.

Usage Example

  1. Scenario: You have a list of customer orders and you want to get the third order for a specific customer.
  2. Setup:
    • Data: Connect the output of a component that returns the list of orders.
    • Key: Enter orders (or the appropriate key that holds the list).
    • Index: Enter 2 (since indexing starts at 0, 2 is the third item).
  3. Result: The component outputs the third order, which you can then pass to a “Send Email” component to notify the customer.
  • Get Data By Key – Pulls a value from a dictionary using a key.
  • Filter List – Filters items in a list based on conditions.
  • Map Data – Transforms each item in a list using a custom function.

Tips and Best Practices

  • Use dot notation (parent.child) to access nested data without writing extra code.
  • Leave the Index field blank if you need to know the position of each item rather than a specific item.
  • Combine this component with Filter List to first narrow down a list before selecting an index.
  • Remember that negative indices count from the end of the list, which can be handy when you always want the most recent item.

Security Considerations

The component only processes data that is already available in your workflow; it does not connect to external services or expose sensitive information. Ensure that any data passed into it is already sanitized if it originates from untrusted sources.