Hi,
I have a requirement to append the values of a particular computation to a local variable using append function
The rule goes like this :
a!localVariables(
local!data : {"x", "y", "z", },
local!finalValues,
a!forEach(
items: local!data,
expression: append(
performSomeComputation(fv!item)
)
now the problem is, the local variable is not getting updated no matter what, I tried using update dictionary as well as insert(local!finalValues, length(local!finalValues) + 1, fv!item) .. but still it wont append .. is there any other method I can use to append values ?
Discussion posts and replies are publicly visible
You would need to define local!finalValues as the a!forEach() update sequence you try below. Expression code can't and doesn't "push" a value into an already-defined variable (the only exception being on a form where saves are executed via user interaction) - instead you need to build the update into your definitions. It can be a tricky paradigm to get used to, I admit, but once you get it, it's pretty easy to follow.
Also you would not need "append()" here - simply assemble your array.
a!localVariables( local!data: { "x", "y", "z", }, local!finalValues: a!forEach( items: local!data, expression: performSomeComputation(fv!item) ), local!finalValues /* for the sake of output only */ )
This works thank you