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
Hii srinivaasant574373 ,
Here is the solution which can cover you use case,
a!localVariables( local!a: { 0, 36, 2 }, local!b: { 2, 82, 2 }, local!arrayWithTheLessSize: if( length(local!a) <= length(local!b), local!a, local!b ), a!forEach( items: local!arrayWithTheLessSize, expression: fv!item + index(local!b, fv!index, null) ) )
Thanks
In my usecase I have both the arrays in a single local variable (local!final)
Like this
I need to perform the addition by iterating this local variable.