hi,
I have two arrays,{"","1"} and {"2","3"}
I want to merge them, but exclude null and have something like this
{"1","2","3}.
Any help is appreciated
Discussion posts and replies are publicly visible
filter(a!isNotNullOrEmpty(_), union({"","1"}, {"2","3"}))
just curious to know, what does this return if both arrays does not have null values
Just give it a try ...
For an implementation that avoids the old and clunky primitive looping functions like filter(), we can use a!forEach() in this (and almost all other) use cases:
a!localVariables( local!array1: {"", "1"}, local!array2: {"2", "3"}, a!flatten( a!forEach( union(local!array1, local!array2), if( a!isNotNullOrEmpty(fv!item), fv!item, {} ) ) ) )
I will try this
tried this, it worked, thank you
a!localVariables( local!a: { "", "1" }, local!b: { "2", "3" }, a!forEach( items:{local!a,local!b}, expression: if(isnull(fv!item),{}, fv!item) ) )