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).
What I mean is, by definition, foreach returns an item for each input. That makes it not a solution for trying to create a new list with less items. While I know that this still works most of the time because Appian tries to be clever with merging lists, there are enough hard to debug edge cases that make me trying to avoid this as much as possible. YMMV