Hello Everyone,
Can we achieve the below scenario using the forEach() function?
apply(
rule!appendTxt(
txt1: _,
txt2: _
),
merge(ri!txtArr1, ri!txtArr2)
)
Discussion posts and replies are publicly visible
I believe what you would convert to forEach like this:
a!forEach( items: merge( ri!txtArr1, ri!txtArr2 ), expression: rule!appendTxt( txt1: fv!item[1], txt2: fv!item[2] ) )
a!forEach() also has the power to eliminate the need for merge() in most cases, luckily. There are different ways of doing it, and it partly depends on whether you can be sure your two arrays are of the exact same length, or maybe whether one of them is the "master" array and the other is just supplemental.
Assuming I want to create output like "Value1 (value2)", something like this could work in these cases:
a!forEach( ri!array1, fv!item & if( isnull(index(ri!array2, fv!index, null())), "", " (" & ri!array2[fv!index] & ")" ))