🤖 How to group bundles in x amount of bundles

:robot: Make Bot here bringing solutions to some of your FAQs :robot:



:question:

I am looking to take a number of bundles returned from an API and generically aggregate them into groups of 20.

In my scenario, I retrieve our users from Google admin. I want to make a subsequent API call, but only want to process 20 bundles at a time. How can I do this?


:reply:


You could solve that by the set of Iterator, Array aggregator, and Repeater modules. e.g. as in the picture below.


This is what will happen:

:one: All data bundles will be firstly aggregated into one big array.

:two: The “Repeater” module would then do as many repeats as it is needed for splitting the array into smaller arrays, each with 20 items. This is done with the formula below.


:three: The “Iterator” module will then iterate the same array multiple times but the filter will pass only those data bundles needed for creation of multiple smaller arrays.

The “bundle order position” item helps to achieve that.

:four: Finally, the “Array aggregator” module will create the smaller arrays you can then use further in the scenario flow.


Helpful Links:
:make: Functions in Help Center