Getting all data

Dear Make Community,
I have a return from an api, where i have a huge collection, and inside of it, I have arrays of tickets.

How would it be possible to just get list of all the tickets, I tried with iterator of iterators and it burned 3500 operations. is it an easy way to get them all, I tried set variable but doesn’t work …

thanks a lot for the help.

Kr’s

Benjamin

1 Like

Hey there,

whats inside of the collections themselves? You can use map() to create a primitive array with the names lets say, then use merge() to make it a string.

Hi Stoyan,
Inside of it I get some parameters like id, and other tickets info.


I try set variables to just get the list of all ids of tickets using: {{map(31.array.tickets; “id”)}}, but it only returns me the tickets of the first bundle .

=>

1 Like

So the first bundle has only 3 tickets inside? And you have multiple bundles?

In that case you need to aggregate first to get all the bundles in one array, then from there get an array of only the tickets.

So totaly right, i have a bundle with multiple tickets, and a lot of buldles.
When trying your solution, somehow i don’t get the right response, my previous step is already an array aggregator ( it comes as it links multiple api call to retrieve all the data )

.
So how can agregate this again in one array?

1 Like

You can use flatten() to pull the nested array up and have one array, then use map() to make a primitive array of only the ticket IDs.

3 Likes

I’m trying multiple ways with flatten to get the nested array, but somehow it gives me empty response: I’m trying with: {{flatten(map(31.array.tickets; “id”))}}
And when I try to simply flaten the array:


The output is equal to the input:

1 Like

Ok got it with {{flatten(map(93.level_1; “tickets”))}}, thanks a looooot, it helped me for something that already took me 4 hours of work ( or more :slight_smile: )
Really a big thanks :slight_smile:

2 Likes

A last mini question, is there a way to add to the flatten data, some additional info from the parent, I’m trying like this but doesn’t work {{flatten(map(93.level_1; “tickets”; 93.level_1.payment_method))}} ?