A Better Solution for "How to group bundles in X amount of bundles" (Chunking Arrays)

This is a tutorial for slicing an array into multiple operations.

This is usually needed for external API calls that has a maximum array limit, so we need to split into a smaller batch size (also known as “chunk”, or “chunking”) per operation.

Original Solution

The original solution suggested using three modules with a complex filter:

This uses 2n + 1 operations, n being the number of chunks needed. For example, if we have 1000 items, and we want to output arrays sizes of 100 per operation (10 operations), we require 2*10 + 1 = 21 operations.

The Slice Function

Did you know that you can use the built-in slice function to get selected sub-items from an array?

The slice tooltip states:

Screenshot_2024-07-29_120710

Proposed Solution

The new solution only requires 1 operation (a single operation) no matter how many chunks we need:

This is because instead of using an Iterator-Aggregator pair to group the chunks, we can directly use the slice function in your “Make an API Call” module itself!

Screenshot_2024-07-29_120759

For example, if we have 1000 items, and we want to output arrays sizes of 100 per operation (10 operations), we require 1 operation (just the repeater module) to generate the 10 bundles (operations).

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

9 Likes
🤖 How to group bundles in x amount of bundles?
Grouping input from Excel in batches of 10 (Aggregator Question?)
How to divide up an http GET request into batches based on how many bundles are available
Split Array Aggregator with 15.000 data into packages of 50
Pagination and Rate-Limits
Web Archive
Is it possible to chunk a big list of leads into groups of 10 with apollo API?
Adding an item to a Pipedrive array without overwriting the original values
How to merge results from multiple YouTube search iterations into one array?
More operations then expected in HTML extraction
Recipe Card Automation
How to create a full Webflow CMS RSS feed using Make.com?
Use Custom GPTs (Team account) to create outlook drafts
SUM values of Make modules (Increment and variable)
Telegram bot watch update module missing?
New to Make and Social Media Automation
How to Connect Acuity "New Appointments" Contact details to Google Contacts?
How to fetch text from a bundle
How to loop over an array and generate HTML with native functions?
How to combine 2 scenarios?
Google Calendar Set current week date
Help with a Json Scenario
Meta integration with Clickup
Guided product creation assistant
How to process large number of bundle data as chunks?
Google Workspace Admin module configuration
Integration of Planyo with Lexware
:house_with_garden: Make Community Roundup: July 2024 [CR]
I want to append page content into a database page from another database page content
Range and other functions not available?
Processing Array Output in Chunks
Getting started into make
How can I group an array into chunks of 5 to send in batches?
200 people batching from Google Sheets into Google Calendar
How to use AI to analyze salesforce case, then fill the lookup relationship field on the Case?
YouTube search automation: how to avoid duplicates and get a limited number of videos
From iterare to pdfmonkey
Error Handling BAD combo: Sequential Processing + Incomplete Executions
Emails in batches
Using Make
Seeking Best Approach for Scheduled Automation in make.com scenario
How to get a spreadsheet ID from a file I'm uploading in the same scenario?

Set Up

How to set up the Repeater module to do this?

You can directly calculate the number of chunks needed in the Repeater module. The trick is the “Step” field, to increment the i variable based on the output array (single chunk) size.

In this example, we are using a chunk size of 4.

  1. Since the slice function begins from index 0 (first item of the array), the Initial value must be set to 0.

  2. To calculate how many Repeats (output operations) we need to chunk them into the array size limit, we use the length function to get the total amount of items in the original array, and divide by the chunk size.

  3. Then, the Step field will simply be just the chunk size.

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

7 Likes

Amazing thank you @samliew :pray:

Thanks for this showcase that is really clear. I’ve used it to chunk an array that is created by an aggregator.
I realized also that in the case of an array aggregator, the grouping capability is also a great way top manage trunks using :

  • {{round(1.__ROW_NUMBER__ / 67.chunkSize + 0.5)}}
    where 1.__ROW_NUMBER__ is the row number returned for each array aggregatore collection
  • 67.chunkSize is a variable to set the number of items in each chunk

I have created a module in my private custom app that does these three modules in a single operation.

For more information and installation instructions, see How to send multiple inline keyboard buttons in a single Telegram Bot message with dynamic data?!

@samliew