Help for a extract a simple array

Hello,

I receiving a list of customer orders from a JSON that I’m parsing. After I’ll have an Iterator for each order.

For each order I would like to populate a text field with information on each PartNumber with the respective quantity. I would like something like this:
“PartNumber1 xQty1, PartNumber2 xQty2, PartNumber3 xQty3”

right now I’m able to correct extracting the information with the below formula.
{{map(14.packages.cart; “merchant_product_id.id”)}}
{{map(14.packages.cart; “quantity”)}}

I’ve tried to use the merge function but it states all the PartNumber and after the Quantities.

Do you have any idea on how to do this without adding an additional operation in Make?

Thanks!

Hey, Daniele.

I don’t think there’s any reasonable way to achieve this without any extra operations unless you have an Enterprise plan and can use custom functions, but you’re off to a great start! You already have your 2 arrays mapped, which is the first step.

We will need an iterator+aggregator combo for this, but the good news is that it will only consume 2 operations for every order, no matter how many products it has.

We start with our 2 arrays:

We iterate through one of them:

Then we aggregate them to text. We can use the bundle order position (index) to map the values from the other array:

Besides that, I’d say your best bet is a crazy RegEx that extracts the data from the whole “orders” array before splitting it, or building a custom app. I would strongly advise against the RegEx approach though unless you’re really comfortable using them, or it would very likely not be a fun experience.

1 Like