Distribute Airtable records by PO number and provider

Hello,

I have a problem with a scenario that has me a bit blocked, let’s see if you can help me.

I need to generate a series of material orders to suppliers independently by order number.

So I have to generate separate files for each of the suppliers and orders.

I put a scheme for you to understand it better.

As for the data structure, it is as follows:

The process is as follows:

In the scenario I have configured I make a call to the supplier order table. It returns the different records in this way:

I need

1 . Group all records by order number.
2. To split those orders into each of the suppliers.
3. Generate unique documents for each of the filtered records.

I don’t know if the best way to do this is to start by separating the records by order number with the “Table aggregator” function.

Can this be the start of the process?

With this option it has returned me the different records grouped by order, but I don’t know what else to do with them to go to point 2 of grouping by suppliers.

I look forward to hearing your impressions.

Thank you

I have thought about using another type of configuration.

This time I started by making a query to the main table which is the order table.

After giving me the line item records that make up each one, I make an interator to separate each line item.

And then I identify fields such as products, suppliers of each one and other data that I will need.

But I don’t know how to continue to group by order number, as each order can have 1 or more records and I don’t know the exact number.

Thanks

Coud you solve this?
i have to do somethig like that and then paste into a google docs template