Please observe the result of these forEach, (1. and 2.):
1.
a!forEach( items: {1,2,3,4,5}, expression: if ( fv!item > 3, fv!item, {} )
)
results in
meanwhile
2.
a!forEach( items: {1,2,3,4,5}, expression: if ( fv!item > 3, fv!item, null )
Question: Why forEach 1. does not outcome five members in the list?, I expected this result
Discussion posts and replies are publicly visible
Hi Rafael,This is the expected result and this is a subtle behavior in a!forEach that often catches people off guard.Here’s the difference:
a!forEach
{} is treated as an empty list, so a!forEach skips that item entirely.
{}
null is treated as a value, so it's included in the output list.
null
That’s why in example 1, only 4 and 5 appear, the others were dropped because {} returns nothing. Using null ensures the full list structure is preserved.
Hope that helps!