Sometimes when working in Tines, we need to perform a task multiple times based on certain criteria.
Looping allows us to iterate through data and perform an action for each item.
If we have an array of data in Tines, we can also loop through it using an "event transform" action.
As we loop:
We can pick and choose which data points to use.
This allows us to rebuild the array to have the format we want.
We can apply tags to check for conditions.
Looping is a useful technique to iterate through data and perform the same action for each item.
For example, if we make an API request and receive 100 items out of 349 on page 1, that means there are still 249 more items on subsequent pages that we need to retrieve.
We can apply a pattern called "pagination" in Tines:
Make additional requests, going to each next page by incrementing the "page" parameter (+1 for each request)
This shifting of the request with a slightly different parameter is referred to as "looping"
In this example let's take a closer look at what some looping examples are available within Tines.
A really popular way to loop through an array quickly in Tines is by using the event transform with loop mode flipped on. This gives us the ability to quickly reformat an array, apply calculations, and even add new items to our array.
When we do this we can pick and choose what data points are used. This makes it so we can rebuild an array to look however we’d like. We could also apply tags to check for conditions if we need.