Hi, In foreach loop I am fetching some value. So the requirement is at current index of foreach loop I am updating some default value and then at the proceeding indexes i want to increment by one in the default value. Here is how I am doing it.
a!forEach( items: local!rawData_at, expression: if(fv!index = 1, a!update(fv!item,"KeyTaskModel",ri!KeyTaskModel_StartingOrder_int), a!update(fv!item,"KeyTaskModel",fv!index+1) ))
What it is doing is i have saved the value from rule input ri!KeyTaskModel_StartingOrder_int at the first index but the subsequent indexes is adding value to the index value not the rule input value. How can I achieve that? attaching the output below.
Discussion posts and replies are publicly visible
Try this
a!forEach( items: local!rawData_at, expression: a!update( fv!item, "KeyTaskModel", (fv!index - 1) + fv!KeyTaskModel_StartingOrder_int ) )
it worked thanks.