Can I do "pivot table" with make default functions? :D

Hey guys!

Well – I just a little bit get out of ideas or my . :slight_smile:

I receive via webhook order data. For some statistical needs I want to parse those data.

As You can see I have array Products with some collections.

  • each collection is separate product that was bought by customer.
  • each collection can contain product of the same “name” parameter

Now I want to set variable where I get

  • sum price_brutto of each collection with the same name parameter
  • total sum of collection where name is the same

In uploaded case I want to get
Odbitki_sum = 15.2+13.3
Odbitki_total = 2

I created array with each unique name (that one work flawless)
Zrzut ekranu 2022-10-22 o 22.10.30

Now I want to use Iterator of this array to iterate through all products. I started with this and wanted to use some if logic but it just doesn’t work.

Zrzut ekranu 2022-10-22 o 22.11.55

Any suggestion?

Ah! One thing – of course I can iterate through each collection separately but in some cases we get orders with 500+ elements and it could be expensive, so I want to with “tricky way”.

Numeric aggregator?

Not quite. Is sums whole array.

I want to have all product sum separately.

Use an iterator to grab what you want and then sum them set variables to store the results if necessary. It’s like programming (gasp).

As I mention in my first post – iterating through e.g. 500 elements would be quite expensive so I though that I can go with some “tricky” way. :slight_smile:

There are no shortcuts in make unless you make a custom app with IML functions.

Then you can embed logic to process.
Make’s business model is built around processing operations. If you try to work around it you’ll end up spending more time bashing your head against a wall. Get it working first and then try to optimize with more advanced features.

1 Like