How to Dynamically Create Unique Bundles of Grouped Data?

Hey Make-Community,

I am new to make and read a lot of topics through my building process. Until now I was able to handle all problems with the existing topics in here. But since 2 days I am struggling and finally reaching out to you guys and asking for advice.

Problem Brief:
I am receiving data from a webhook and need to prepare that data so I can updated records in airtable.

How can I dynamically pair items from two arrays (Record ID and Date) so that each item in the first array corresponds to an item in the second array by index? I’m looking for a solution that works regardless of the number of items in each array.

Current State

[
{
“Date”: “2024-12-30”,
“Slots”: 232,
“Record ID”: [
“6762a3f9734ac8aa19488783-rec3gPMj11QECkNj0”,
“6762a3f9734ac8aa19488783-recn6UXh5x7PD5rJB”,
“6762a3f9734ac8aa19488783-recTP0sXD7wExHJF4”
],
“StartTime”: “16:41”
},
{
“Date”: “2024-12-31”,
“Slots”: 232,
“Record ID”: [
“6762a3f9734ac8aa19488783-rec3gPMj11QECkNj0”,
“6762a3f9734ac8aa19488783-recn6UXh5x7PD5rJB”,
“6762a3f9734ac8aa19488783-recTP0sXD7wExHJF4”
],
“StartTime”: “16:41”
},
{
“Date”: “2025-01-10”,
“Slots”: 232,
“Record ID”: [
“6762a3f9734ac8aa19488783-rec3gPMj11QECkNj0”,
“6762a3f9734ac8aa19488783-recn6UXh5x7PD5rJB”,
“6762a3f9734ac8aa19488783-recTP0sXD7wExHJF4”
],
“StartTime”: “16:41”
}
]

Desired Outcome:
The goal is to transform this into a structure where each Record ID is matched to the corresponding Date dynamically, in order, so that the result looks like this:

[
{
“Date”: “2024-12-30”,
“Slots”: 232,
“Record ID”: [
“6762a3f9734ac8aa19488783-rec3gPMj11QECkNj0”
],
“StartTime”: “16:41”
},
{
“Date”: “2024-12-31”,
“Slots”: 232,
“Record ID”: [
“6762a3f9734ac8aa19488783-recn6UXh5x7PD5rJB”
],
“StartTime”: “16:41”
},
{
“Date”: “2025-01-10”,
“Slots”: 232,
“Record ID”: [
“6762a3f9734ac8aa19488783-recTP0sXD7wExHJF4”
],
“StartTime”: “16:41”
}
]

Attachements:

1. Scenario overview

2. Outputs

Output Bundles for Webhook [11]:

[
{
“selected-dates-2”: “2025-01-10,2025-01-17,2025-01-24”,
“field”: “13”,
“selected-dates-times-slots”: “[ { "date": "2025-01-10", "settings": [ { "startTime": "11:44", "slots": 2 } ] }, { "date": "2025-01-17", "settings": [ { "startTime": "11:44", "slots": 2 } ] }, { "date": "2025-01-24", "settings": [ { "startTime": "11:44", "slots": 2 } ] }]”,
“selected-dates-times-slots1”: “[ { "date": "2025-01-10", "settings": [ { "startTime": "14:47", "slots": 4 } ] }, { "date": "2025-01-17", "settings": [ { "startTime": "14:47", "slots": 4 } ] }, { "date": "2025-01-24", "settings": [ { "startTime": "14:47", "slots": 4 } ] }]”,
“selected-dates-times-slots2”: “[ { "date": "2025-01-10", "settings": [ { "startTime": "14:47", "slots": 5 } ] }, { "date": "2025-01-17", "settings": [ { "startTime": "14:47", "slots": 5 } ] }, { "date": "2025-01-24", "settings": [ { "startTime": "14:47", "slots": 5 } ] }]”,
“selected-dates-times-slots3”: “[ { "date": "2025-01-10", "settings": [ { "startTime": "16:49", "slots": 13 } ] }, { "date": "2025-01-17", "settings": [ { "startTime": "16:49", "slots": 13 } ] }, { "date": "2025-01-24", "settings": [ { "startTime": "16:49", "slots": 13 } ] }]”,
“record-ID”: “6762a3f9734ac8aa19488783-recU35uiFIwN92qiy,6762a3f9734ac8aa19488783-recNGHJwsqI56dbnK,6762a3f9734ac8aa19488783-recVtles0ng0ofPW4”,
“record-ID-2”: “6762a3f9734ac8aa19488783-recPaGCcnmKMnCDgQ,6762a3f9734ac8aa19488783-recr8WLn2vX5y6G9R,6762a3f9734ac8aa19488783-recekLeBPHrl4M3Zo”,
“Record-ID-3”: “6762a3f9734ac8aa19488783-recVz4H2IgewcZ7mJ,6762a3f9734ac8aa19488783-recq2XAByKVkS4JMb,6762a3f9734ac8aa19488783-recT1awzPIRxwvJ4C”,
“Record-ID-4”: “6762a3f9734ac8aa19488783-rec0e9WxLd2WvCKeV,6762a3f9734ac8aa19488783-reca3BkD0Nkewm88k,6762a3f9734ac8aa19488783-recixf0cmEjh1PoNn”,
“Producer-ID”: “6762a3f9734ac8aa19488783”,
“cf-turnstile-response”: “0.UraLkdjodbo-S8SzUDcd3TVW0zJ5JEY3qG1l2HamnHCOywlOd-ceC4uD6JA5OzXKaaZGuHRmL3iY3ybkN_DKHPqBZfRXtjKyjnFf6GFJDQzF9inuXDRXllEyubvxsjameM8f2sJ6YxB9j3abnXqebJCs4d4zcMghNShqtq_Os-H97YIHzd2qwQMiE_vE_f3mlK-Ex6hyAxo-xy1BaD4COtxFei7DU_xM_a6Yp9eAz5XNGUnGdowyG6jwUSD5u9MUnOnSq46NszLX-5Ys_tc0wkJBhVahJxE8qpzc8paP2tfM80zetAmpITUoT0Z2qi62JOqYRtMOhBmg1MYWco5PeyJiLuGN82nvx3yz3KEwgd79EJuH7snamJDMS685kWaReFS3VDe2KE2wqFg-NWotlhYC75mvDR5vXTsycz_Zo25QJUsY059dCLCDMuyZNzDPz8r_y2tc_USlS3B8oaHSrI1ogF3u0T7GXyiDC_cWF0CGoStyBYq54hGUVRT6fY0yAT7hY-864WGcUzHXtz2x6AdVXISPLg6p6udAv54Hcl11351E2ipXavzp_XD13aYmDe5JH6_DRTLNpqidY3GJUosZWRctxhM_vw1VAtPJn7nWSw5kF3T_Fd3QiEyi3M2xlkxCs_flH5bJpJ04GuNvQ8Vr2LQ3z_HNv8eutVGdZV3oy-RXRauazqlA7me5iBzCN5HLgDRs2Z2ZeduHPd4ohKf_A5ofuB5cO3mYenNMpfZN0cC1Wp42PHD9UPVBgGMgPCAubHcCzzNBtgGA6qKW-n0vz8ZeSkZpO_30ty0gw4KnE5-qauJk3ZhzionpMPAq.kSl2Hhj75W4OoQ9OKj9Gpg.40dda03a7cd06bf1e1279e94202ef36a48d4c911b361826a42d808c5325aff5b”
}
]

Input Bundles Parse JSON [3]:

[
{
“json”: “[ { "date": "2025-01-10", "settings": [ { "startTime": "11:44", "slots": 2 } ] }, { "date": "2025-01-17", "settings": [ { "startTime": "11:44", "slots": 2 } ] }, { "date": "2025-01-24", "settings": [ { "startTime": "11:44", "slots": 2 } ] }]”
}
]

Output Bundles Parse JSON [3]:

[
{
“date”: “2025-01-10”,
“settings”: [
{
“startTime”: “11:44”,
“slots”: 2
}
]
},
{
“date”: “2025-01-17”,
“settings”: [
{
“startTime”: “11:44”,
“slots”: 2
}
]
},
{
“date”: “2025-01-24”,
“settings”: [
{
“startTime”: “11:44”,
“slots”: 2
}
]
}
]

Output Set multiple Variables [4]:

Operation 1:
[
{
“Date”: “2025-01-10”,
“StartTime”: “11:44”,
“Slots”: 2,
“Producer-ID”: “6762a3f9734ac8aa19488783”,
“Record ID”: [
“6762a3f9734ac8aa19488783-recU35uiFIwN92qiy”,
“6762a3f9734ac8aa19488783-recNGHJwsqI56dbnK”,
“6762a3f9734ac8aa19488783-recVtles0ng0ofPW4”
]
}
]

Operation 2:
[
{
“Date”: “2025-01-17”,
“StartTime”: “11:44”,
“Slots”: 2,
“Producer-ID”: “6762a3f9734ac8aa19488783”,
“Record ID”: [
“6762a3f9734ac8aa19488783-recU35uiFIwN92qiy”,
“6762a3f9734ac8aa19488783-recNGHJwsqI56dbnK”,
“6762a3f9734ac8aa19488783-recVtles0ng0ofPW4”
]
}
]

Operation 3:
[
{
“Date”: “2025-01-24”,
“StartTime”: “11:44”,
“Slots”: 2,
“Producer-ID”: “6762a3f9734ac8aa19488783”,
“Record ID”: [
“6762a3f9734ac8aa19488783-recU35uiFIwN92qiy”,
“6762a3f9734ac8aa19488783-recNGHJwsqI56dbnK”,
“6762a3f9734ac8aa19488783-recVtles0ng0ofPW4”
]
}
]

Thanks in advance!

Hey @theagency,

Use an iterator to run for every bundle in that is in output in module 4. On the Airtable update record, use the data from the iterator with the green light.

If this is not clear please let me know, happy to help :slight_smile:

Dimitris | 3Nuggets

1 Like

Hi @DimitrisGoudis ,

thank you for your fast reply. I already tried it with an iterator, but maybe I am doing something wrong.

When I connect the iterator I selected the array “record ID” from the previous module [4].

After that the iterator iterates over those but in 3 separate Operations.

Which will be a problem when sending the data to airtable. Because later on when searching for the records with the correct “record ID” (“Slot ID” = “record ID”).

And this results in 9 Operations (3x3) in airtable, which bring the wrong output at the end, because the last 3 operations (7,8 & 9) update the record ID’s (2/3) incorrectly again:

Only the 1., 5. and 9. Operation is needed. Because they are updating the records in airtable correctly.

Hope you understand my explanation :slight_smile:

Hey @theagency,

I am trying to understand your explanation.

If one operation is wrong, then all of them should be wrong, and the same for correct operations, right? So why do you mention that the 1,5 and 9 are correct?

I guess that you want to keep in your process only records in bundle numbers 1,5 and 9, right? If so, you have to process only the bundles within this serial number.

Please verify the logic here, and I can recommend a solution.

Thanks
Dimitris | 3Nuggets

1 Like

Hi @DimitrisGoudis ,

you are right. I meant by wrong that just the wrong Information will be updated in airtable.

In this example there are 3 different “date” values. The “start-time” and “slots” stay the same. But for each “date” there has to be a unique “record ID”.

Currently the update records module is doing 9 Operations. Because the webhook will always provide one “record ID” (e.g. 6762a3f9734ac8aa19488783-recU35uiFIwN92qiy) for each “date” value, I configured the airtable to create one row for each “record ID”. So the 9 Operations will only affect 3 rows (“6762a3f9734ac8aa19488783-recVtles0ng0ofPW4”, “6762a3f9734ac8aa19488783-recU35uiFIwN92qiy”, “6762a3f9734ac8aa19488783-recNGHJwsqI56dbnK”) in airtable.

In between the 9 Operations only the 1., 5. and 9. are updating the rows correctly, but the 1. and 5. will be overwritten by the 7. and 8. operation. So in the end only the data in row “6762a3f9734ac8aa19488783-recVtles0ng0ofPW4” (=Slot-ID) will be correct. and the other two “6762a3f9734ac8aa19488783-recNGHJwsqI56dbnK” and “6762a3f9734ac8aa19488783-recU35uiFIwN92qiy” are updating the wrong value for “date”.

I made some screenshots:

Hope this helps… :sweat_smile:

Hey @theagency,

What I get is that you want to exclude the sequential number of updates 2,3,4,6,7,8 so only 1,5,9 will run.

The fastest and easiest way to solve it (but not the most efficient) is to do the following:

  • Before the iterator, add the “Repeat” module. In settings, add the Lenght({array}}). So the steps that will follow will run the as many times as the number of objects exists in your array.

  • The next module will be your iterator. On this connection, add a filter so the process will continue only when the sequential number is 1, 5, 9.

  • Then add the Airtable node using the green data from the iterator.

Does it solve your issue? Happy to get on your trouble for 30 minutes and try to solve it live in conversation with no commitment. Here is my calendar link: Solve it in 30 mins | Dimitris Goudis | Cal.com

Thanks
Dimitris | 3Nuggets

1 Like

Hi @DimitrisGoudis ,

thank you for your response.

The issue with your solution is that it only addresses this specific example. In my case, I need a solution that can scale with the number of “dates” and “record IDs” provided.

For example, if only two “dates” and two “record IDs” are transferred, only four (2x2) operations will take place, and the filter (1, 5, 9) will not match.

Thank you for the offer and your time! I will book a slot. :pray:

@theagency,

I expect that every single record you receive in your webhook belongs to one single record on Airtable, is that right?

Thanks

1 Like

That’s correct. From the webhook I receive multiple record ID’s and those refer to single records in Airtable.

Hey @theagency,
Based on this, the process should run for every record that comes in the webhook; where each record is unique, then the process should not exclude any record from the process.

The problem you have mentioned is updating the wrong records on Airtable.

Could you record a video running the process using the iterator? This would be very handful to me to guide you correctly :slight_smile:

Thanks