Integromat Iterator and Array Aggregator Finally Explained
In this video you’ll learn exactly when and how to use Integromat Iterators and Array Aggregators and why they’re so helpful in many cases.
Watch this video or read the step by step process below. 👇
Lot of people ask me, “Hey, Manuel, what is an Iterator and what is an Aggregator? And why should I use them and when?” So here I’ll show you how they work and when you should use them. Then, you will never have to ask those questions again.
Here is a little sample scenario where we request a five-day forecast from a weather API. This is from an open weather map.
When we requested a five day weather forecast, this is the data that we received. We get a list of all these time entries with individual weather forecasts.
The second module is Google Sheets Add a Row which we set up the sheet tab with these columns – date, weather, temperature, humidity and wind speed.
The data in these columns were just mapped from the data we got from our five day weather forecast request in our first module, like this.
This procedure fills just one of the entries in the list that we received from the five day forecast, meaning it’s not every entry, but we want to have all of them, of course.
You can see in the data that the list is an Array and an Array is basically a list of collections or items. It can be a simple string. It can be a number or it can be a collection, like in our case, where we have other values inside of that collection and an array can hold one item. An array can hold 100 or 1000 items. It is dynamic. And that is the big point. If something is dynamic, such as the Array, then we want to split it up if we want to process it individually. And since we don’t know yet, if there are 40 or 20 or ten or one bundle, we have to use the Iterator to split it up. Basically we split up the array into one, two, three, and each of these entries will be processed individually.
Add the Iterator module, and here it expects as an input, an Array.
We go in here and select our List Array.
You can see the Array with the square brackets. The brackets indicate it’s an Array.
The array contains a dynamic list. If you want to access any of the items in the array, you may click on any of the items under the array . But that means it will pick the first entry of that Array and not the dynamic amount of Arrays.
That is what a lot of people have problems with. They can’t access the other items of Array, but we want to access all of them. We want to process all of them. And that’s why we have to split it up.
Select the list as the entry, run it once, check the output and you have the Array as the input with all these collections.
And as the output, we get bundles. A bundle is processed individually throughout the rest of the scenario. So we have bundle number one, which will be processed first, then we have bundle number two, which will be processed next. And bundle number three, and so on.
You could visualize this by clicking on the airplane icon at the bottom.
Make sure to update the Google Sheets Add a Row module to use the actual data from the Iterator and not from the five day forecast. So it would use only the first item of the Array list. Use the value from the Iterator, which shows the same values that you would have inside of the list and you can map it directly from there. Use the dynamic value because that is what you need. For weather, use the main temperature, humidity and the wind speed.
It will now be all dynamic. Run it once and it will add 40 entries inside of the Google sheet.
As you can see it has all the values. We split it up so that is when you should use an Iterator.
Here is a short visualization. The Iterator splits up the weather forecast data and the data are then processed individually. The next part is the Aggregator, which puts everything back together.
To demonstrate we use the Text Aggregator and the Iterator as the source module or you can use a module that outputs multiple bundles, like the Search Rows Google Sheet module. It will output multiple bundles, and then you can use a Text Aggregator or an Aggregator to wait basically until all bundles are at that stage, combine them in any way you want and then process the rest of the scenario with just one bundle.
With the advanced settings, you can use, New row. And then under Text , add the temperature, weather type, and also the weather description.
Processing this you can see the output of the Text Aggregator, it combines everything back together.
The Iterator always uses one operation no matter how many items you have. Everything that comes after the Iterator will use as many operations as the number of items in the Array. The Aggregator puts everything back together and uses only one operation.
The output of the Text Aggregator is a very long text string. If you want, you could send it to Slack or to any messaging platform with available modules.
So that is how an Iterator works and how an Aggregator works. Iterator splits it up. An Array Aggregator combines it back together and then you can use it further.
Another example is WooCommerce or ecommerce in general. If you have a new order, usually you don’t know before the order comes in how many items people purchased or how many different products they’ve purchased. So the line items are usually an array inside of WooCommerce.
Here is what it looks like. You can see, there’s an Array based on the square brackets.
If you want to process them individually, each line item, or if you want to know how many of these items have they purchased and want to track that somewhere, for example, in the Google sheet, then we have to split it up using the Iterator, then add a row to a Google sheet or do another action. Then we can combine it back together. And finally, we can create an invoice, for example, on QuickBooks.
Click on the airplane button again at the bottom just to know how the whole flow would look if it splits up into three or how many bundles there are.
Automation is the way to go for any growing business cloud-based best practices and no code platforms. Even if you’re new to coding, Integromat will help you build the business you want without any prior programming experience! Integromat is a simple platform anyone can use to automate their business. Whether you want to automate your social media marketing, email marketing, or eCommerce site, Integromat makes it easy to set up and execute the right automation strategy in 30 days or less. The number of integrations available is almost as expansive as your business’ potential. With Integromat, you can automate just about anything! Automation is one of the most important skills to have in the coming years. It is second in importance only to coding and becoming a confident coder. Automation will allow you to succeed in your marketing, business and computing career. However, it can be quite complex sometimes, but Integromasters is the best course to learn from. With this course, you will be able to add automation to your business, no matter what processes you use. Learn from our experts and communicate with other automation enthusiasts online! For a limited time only we are offering free access to the course with no risk to you! Click here to find out more.