Hi,
I have a local variable with 2 items .
I need to add each element in the array with the corresponding index and display the total . Eg {1,2,3} +{1,2,3} = {2,4,6}
But in my case I can't apply the addition directly . It should be in a loop. I even tried using merge function but it is not working.. . How to achieve this. The below output is present inside a local variable (local!final).I need to add {0+2,36+82,2+8} and form a single array.
Discussion posts and replies are publicly visible
You can try something like this! In your case the output is in local!a in the sample code below. you can ignore the other two variables local!x and local!y. Line 5 to 7 has actual solution.
a!localVariables( local!x: { 0, 36, 2 }, local!y: { 2, 82, 8 }, local!a: a!foreach({ 1, 2 }, if(fv!item = 1, local!x, local!y)), a!foreach( local!a[1], sum(fv!item, local!a[2][fv!index]) ) )