How to aggregate data after multiple uploads without overwriting variables?

Hi you all,

I’m quite new to make and having an issue in my scenario. I get files from Google Drive, iterate through them, and upload them to the OpenAI API to use with my assistant. If it’s a PDF, I convert it first; otherwise, I upload it directly. After that, I aggregate the uploaded file IDs of each branch.

The problem is: each upload creates a separate operation in the Array Aggregator and then in the Set Multiple Variables module. As a result, the variable gets overwritten with each iteration. In the final router branch, when I try to retrieve all file IDs from both the PDF and non-PDF uploads, I end up with only one file ID instead of a full list.

Does anyone kniw how I can make sure that the Array Aggregator only sets the variable after all upload requests are complete—so I get a proper array with all file IDs?

Hi @ReiFel ,

Welcome to the Community.

You just need to put that bottom array aggregator after the “get multiple variables” module. The “get multiple variables” will then read the variable(s) produced by any “set multiple variable” modules and the array aggregator will then aggregate these into an array.

Thank you Terry for your relpie,
I tried it, but I somehow have the same issue again.
The array aggregator (53) runs 2 operations - for each of my 2 test files the scenario is triggered until the end. I want to append them to the array and don’t overwrite them.
I will attach another screenshot for this.
Is there maybe a tutorial, or a blueprint which adresses this issue?

Hi @ReiFel ,

I can see from the screenshot that the array aggregator is not set to aggregate anything. I’d expect to see the grey shading extending from the aggregator back to the iterator, but it only extends to the ‘Get Multiple Variables’ module.

Within the final aggregator, you need to set the Source Module to be the iterator.

The help file for aggregators is here:

And this training course covers Iterators and Array Aggregators:
https://academy.make.com/courses/IntermediateC01

Kind regards, Terry.

2 Likes

Thank you Terry,
the iterator as the source solved it.
the point which I did not get, it that the sourcemodul for aggregators is not always the last module ahead of it, but the one where the data is originating from. in this case the iterator.
Thank you!!

2 Likes