Skip to main content

Using the Loop option in Groups

How to use the loop option in groups to process an array

Written by Jamie Gaynor
Updated this week

When building stories in Tines, you may need to perform a sequence of actions on every item in a list - for example; a list of users, security alerts, or IP addresses. Instead of manually creating separate workflow branches for each item, you can use the loop option in groups. Using the loop option when configuring your groups allows you to apply your logic to every element in an array automatically.

Read more about groups in our Overview of Groups article here.

How it works

When you configure a group with the LOOP option, Tines will:

  1. Take an array (a list of items) from a preceding event.

  2. Invoke the entire group for each element in that array.

  3. Emit a single output event containing an aggregated list of the results after all loop iterations are complete.

Loop object

When configuring the loop, specify the path to the array you want to iterate on. Within the group, you can refer to the current item being processed using the special LOOP object:

  • LOOP.value: The current element from the array (e.g., the IP address).

  • LOOP.index: The position of the current element in the array (starting from 0).

Serial vs. parallel processing

Groups offer two main modes for processing the loop:

  • Serial: The elements are processed one after another to preserve the original order of your array in the final output. This option is selected by default.

  • Parallel: All elements are processed simultaneously. Use this option for better performance when the order of the items in the list doesn’t matter.

Note: The parallel processing option does not guarantee the order of the elements is maintained in the final output.

Important considerations

Loop size limit

A single loop can run on an array containing up to 20,000 elements. For larger arrays, it is recommended to:

  1. Use the CHUNK_ARRAY formula to break the list into smaller sub-lists.

  2. Use an explode mode event transformation action to emit an event for each of the sub-lists.

  3. Loop over the lists contained in each emitted event

Error handling

If any single element in the array causes a failure within the group, the entire loop processing is stopped. You must build in error path handling (with a dedicated outgoing event from the group) to ensure your Story can continue processing if an element fails.

Read more about groups in our docs here.

Did this answer your question?