Skip to main content
May 11, 2023
Solved

index wherecontains

  • May 11, 2023
  • 5 replies
  • 0 views

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}

Best answer by stefanhelzle0001

And without "abusing" (IMHO ;-)) foreach

where(
  a!forEach(
    items: {"a", "", "b"},
    expression: a!isNotNullOrEmpty(fv!item)
  )
)

5 replies

May 11, 2023

a!forEach(
  { "a", "", "b" },
  if(isnull(fv!item), {}, fv!index)
)

stefanhelzle0001
Brainy
May 11, 2023

And without "abusing" (IMHO ;-)) foreach

where(
  a!forEach(
    items: {"a", "", "b"},
    expression: a!isNotNullOrEmpty(fv!item)
  )
)

May 11, 2023
without "abusing"

How?? I can see foreach getting used.

where(if({ "a", "", "b" } = { "" }, false, true))

I think this one is "without abusing" foreach.