bundlesmake.com

Integromat / Make.com - How to iterate within N bundles without generating N operations


In Make.com / Integromat, I have an API call result with the following format (I have actually much more bundles, but that is not relevant for my question):

> Bundle 1 : { 
    "InvoiceId" : 1111,
    "InvoiceElements" : [
    { "Id":1, "Description" : "Fish" , "Price" : 10}, 
    { "Id":2,"Description" : "Meat" , "Price" : 30},
    { "Id":3,"Description" : "Tomato" , "Price" : 4}
    ]
}  
> Bundle 2 : { 
    "InvoiceId" : 1112,
    "InvoiceElements" : [
    { "Id":1, "Description" : "Fish" , "Price" : 10}, 
    { "Id":2,"Description" : "Meat" , "Price" : 30},
    ]

And I cannot manage to transform this 2 Bundle-object into a 5-row array, or even a 5-Bundle output , without generating 2 operations (or N operations if I have N invoices/bundles !)

I simply would like t obtain a result like this :

[
    { "InvoiceId" : 1111, "Id":1, "Description" : "Fish" , "Price" : 10, "InvoiceId" : 1111}, 
    { "InvoiceId" : 1111, "Id":2, "Description" : "Meat" , "Price" : 30, "InvoiceId" : 1111},
    { "InvoiceId" : 1111, "Id":3, "Description" : "Tomato" , "Price" : 4, "InvoiceId" : 1111},
    { "InvoiceId" : 1112, "Id":1, "Description" : "Fish" , "Price" : 10, "InvoiceId" : 1112}, 
    { "InvoiceId" : 1113, "Id":2, "Description" : "Meat" , "Price" : 30, "InvoiceId" : 1112},
]

Is there a way to get this object format with a fixed number of operations ?


Solution

  • Due to the nested array, processing your data in make will require more than n operations for n bundles. There are two workarounds to this problem:

    1. If you have an enterprise account, you can write custom IML functions in javascript. This would allow for the data processing to occur in 1 operation regardless of the bundle count.
    2. Use a service like 0codekit.com or autocode.com to host a custom javascript solution, then use an HTTP module to post the aggregated bundles to the endpoint.