wherecontains(null, {"a", "", "b"}) returns 2
i need to get an index of non null values , e.g. in above case it should return {1,3}
Discussion posts and replies are publicly visible
a!forEach( { "a", "", "b" }, if(isnull(fv!item), {}, fv!index) )
And without "abusing" (IMHO ;-)) foreach
where( a!forEach( items: {"a", "", "b"}, expression: a!isNotNullOrEmpty(fv!item) ) )
Unknown said:without "abusing"
How?? I can see foreach getting used.
where(if({ "a", "", "b" } = { "" }, false, true))
I think this one is "without abusing" foreach.
Agreed with Sanchit - it's used in essentially the same way here other than the construct being inverted. I like both ideas.
But I like a!forEach() - anything is better than obtuse unreadable code (which both of you avoided here, whereas I'm thinking about the classical looping functions which almost always forced it upon us).