Help with For Each Loop and Array

Answered

Hey all, I have a peculiar problem in which I've tried every manipulation possible to fix.

Here's the core problem:

I'm running an aggregate result on a table, it also has add-ons. Here is the output. It is an array of objects and works as expected.

Then, I want to do a for each loop to multiply 'Gifts_Collected_gifts_count' (which is the aggregated number). to the '_gifts.CPCollect' value.

The Output is where it all breaks down. Essentially, the Vars Count and CPC, which I convert to_int/dec respectively, returns an array. Therefore, I cannot multiply the array of count against the array of CPC. If I don't convert to Int/dec, then I also get an error that numbers need to be used in mathematical operations. Furthermore, the only calculation happens on the first object in the array as opposed looping through each object in the array.

I've tried create_object_to_entries on the First Array object, I've tried doing the calculations outside for For Each loop and get similar results.

Any ideas on how I can move forward?

2 replies