Skip to main content

Loop Component

Repeat a set of operations on each item in a set of data

Component key: loop

Description#

The loop component allows you to loop over a list of items. This is handy if you have a set of files or pieces of data to process. The loop component can be set up execute a series of actions on each file or item in a list.

The array that is looped over can contain numbers, strings, or complex objects, but all items in the array should be of the same type.

For each iteration of the loop, the loop provides two variables - currentItem and index, which contains the item currently being looped over, and the zero-indexed number of the item respectively. For example, if your array looked like this:

[    {        "firstName": "Bob",        "lastName": "Smith"    },    {        "firstName": "Vince",        "lastName": "Nguyen"    }    {        "firstName": "Sally",        "lastname": "Jones"    }]

The second iteration of the loop would have a currentItem of { "firstName": "Vince", "lastName": "Nguyen"}, and an index of 1.

Looping is particularly useful for looping over files. For example, if you used the Amazon S3 listObjects action to list objects in an S3 bucket, you can use a loop to perform a series of actions on each of those S3 objects.

Actions#

Loop Over Items#

Loops over items, applies each step in sequence, and returns a new collection of the results. Items must be an Array or Object. | key: loopOverItems

InputKeyNotes

Items

data
/ Required
itemsThese are the items to loop over. This must be an Array (list) or Object, and should be a reference to a previous step's results.