Iterator not working on the scenario output

Hi team,

I’m struggling to make this simple thing work. I have this scenario that will be a subscenario for an AI agent. It basically makes a request on an API and returns in the scenario output. The return from the API is a collection of objects.

I want to pick a few of the objects and return them in the scenario.

I’m using an iterator to fill the objects that I want to use, but the iterator is not actually iterating and adding all the bundles in the output:

I have no idea why this is not working…

Any help would be much appreciated.

Thanks
[AI tool] Buscar disponibilidade na Stays.blueprint.json (14.0 KB)

1 Like

You most likely do not need an iterator. Delete it.

Iterators split an array into bundles, so you can process each item separately.

Instead, you should be passing a single Array variable back to your parent scenario.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

I deleted the iterator but the result is the same:

There are 9 bundles after the request and it’s only showing the first one on the scenario output:

1 Like

You’ll also need to change the scenario output to a variable of type array, and remap the array into that field.

Hi @Douglas_Tokuno,

Below is the dummy use case built for your scenario which I had tested:

Two tweaks you can try:

  1. Use “Set Multiple Variables” between Iterator and Scenarios
  2. Remove the Output Structure in Make.com

Let me know if this works for you or if you need further assistance.
If this helps, please consider marking it as the solution. :+1:

1 Like

Hey @Douglas_Tokuno,

maybe you’ve already sorted this out, but if anyone is struggling with a similar issue. We’ve designed the first version of the Output module to serve in the same way as the return statement in programming - meaning, once its hit, it ends the execution. No questions asked.

What’s happening in your case with the iterator is that you take what initially was one bundle and split it into multiple bundles. The return module takes the first bundle, returns it back to parent and ends the execution. The other bundles generated by the iterator are ignored.

If the data you’re working with is split across multiple bundles, what you need is to aggregate it first. Or as @samliew correctly suggested, you can take the “complex array” (array of collections) from the HTTP module and pass it as the output directly - you can use the “Dynamic collection” output type for this.




Btw. I believe there’s some helpful content about this in our help center about this - give it a shot

4 Likes

It worked now! Thank you so much!

I wonder how I would get only parts of the bundles instead of the full data…

Thanks again!

Hi Dan,

I now understand how the scenario output works but I really need to filter some data from the bundle but the solution that I found is basically through iterator + multiple variables.

Since I want to use this as tool for an AI agent, I want to send only the data that matters for the AI and not the full collection.

Is there a way to filter the data before sending it back to the output?

Thanks!
Doug

Hey Douglas, thanks for giving it a shot. I’m glad it helped.

I now understand how the scenario output works but I really need to filter some data from the bundle but the solution that I found is basically through iterator + multiple variables.

Sure, that’s possible. I’d use the combination of iterator + aggregator for this. You’d iterate through the array apply filters inbetween the iterator+aggregator and possibly aggregate only certain fields.
Or you can use a bunch of inline functions - such as omit, pick, map, …

1 Like

It worked perfectly! Thank you so much! :grinning_face:

1 Like