Get values from multiple outputs and calculate the difference of one of its parameter

Hello

So I have 2 JSON outputs, which have almost the same structure (the key name differs but otherwise we have the same data).
I want to compare the 2 collections, and when i find the corresponding entry, then calculate the difference between price.

blueprint (4).json (24.8 KB)

My aggregator output looks like this [ { "description": "Eckaussteifungen v2", "lhNumber": "lh-4273201", "price": "136,80", "quantity": "120,00", "unitPrice": "1,14", "__IMTINDEX__": 1, "__IMTLENGTH__": 3 }, { "description": "Handgriff Halterung v1", "lhNumber": "lh-4273199", "price": "33,64", "quantity": "40,00", "unitPrice": "0,84", "__IMTINDEX__": 2, "__IMTLENGTH__": 3 }, { "description": "Boden Eckaussteifung und Füße Halter v1", "lhNumber": "lh-4273200", "price": "21,36", "quantity": "12,00", "unitPrice": "1,78", "__IMTINDEX__": 3, "__IMTLENGTH__": 3 } ]

my filter after the aggregator looks like this :


and my “set multiple variables” module like this :

Unfortunately, I do not manage to get the proper data from the 2nd collection (here is the output of the first bundle for my Variable module :

[
    {
        "price A": "136,80",
        "price B": "30,24",
        "Diff": 106.56
    }
]

I think I am close but I have spent hours just to understand what I’m doing wrong and I have no clue anymore …

I added a second iterator for my 2nd collection, but i thought there would be an easier solution. Maybe I am wrong :woman_shrugging:

Wouldn’t it be easier to Parse both JSONs and then compare the values that way?

I am not sure… in any case i made it work with 2 iterators, so maybe when i will refactor my scenarios at a later point i will consider the JSONs solution. thanks!