Our goal is to map and filter nested arrays, extracting the median value from variationGoalData when goal: X matches the id from goals where isPrimary = true, and variation is not equal to 1.
We should attempt to break up our steps to get something working, and then later when needed, make it more efficient.
So first, I feel we should get the primary goal ids.
{{map}}(goals; id; isPrimary; {{true}})
Second, iterate through variationGoalData followed by a Text Aggregator module to create a new { "goal": 1, "data": { "variation": 2, "median": 3 } } CSV. Feed that result to Parse JSON to become the array; donβt forget to bracket wrap the [CSV].
Third iterate through the primary goal id array.
{{map}}(CSV-array; data; goal; goal-id)
Now iterate through that result, checking where variation is greater than 1 to get your desired median.
Have fun with the debugging and newly found exception cases!