Reusing Local Variable

Certified Senior Developer

Hi Everyone,

I have a requirement where i can reuse local variable array. For Example

a!localvariable(

local!iterations:{1,2,3},

local!value,

a!foreach(

items:local!iterations,

expression{

append(

local!value,

fv!index

)}))

The output i need is

1st Iteration

1

2nd Iteration

1

2

3rd Iteration

1

2

3

But the output the code is generating is

1st Iteration

1

2nd Iteration

2

3rd Iteration

3.

I thought that local variable should be append with the value and  can use for next iteration but it is initializing every time with null value rather than appendvalue. Could you please help me to get the output i need

Thanks In Advance!!!

  Discussion posts and replies are publicly visible