Skip to main content
omj2851
July 22, 2024
Question

reject function used with index function

  • July 22, 2024
  • 9 replies
  • 0 views

How can we fetch only not null cases from this index function.

pls share the detailed query

9 replies

konduruc733182
July 22, 2024

Hello [mention:67d3e8c7ee954087ae38b3a86b2789c3:e9ed411860ed4f2ba0265705b8793d05] 

This is not sufficient information. Please share the more details. Here is something near to what you have asked for, but not accurate as I am not clear of what you are trying to do and what you have tried.

reject(
  isnull(_),
  index(local!activeTasks,"c26",null)
)

karumurua531442
July 22, 2024

hi [mention:67d3e8c7ee954087ae38b3a86b2789c3:e9ed411860ed4f2ba0265705b8793d05]  could you post your data subset output, please? by seeing that we could post some relevant idea/logic for it 

mikes0011
Brainy
July 22, 2024

I prefer to avoid "reject()" and the other primitive looping functions where possible (which is almost everywhere), as a!forEach() does a better job, is more flexible, and is easier to understand.  Here we iterate over an array of "local!activeTasks" (pulling out arbitrary property "myProperty" first using the property() rule, which does the same thing as index() but we're using the appropriate one for the job it's doing here).  When any given iteration is blank, the loop returns an empty set.  (We wrap the whole thing in a!flatten() since otherwise if every iteration returns an empty set, it would give you an array of empty sets, which a!flatten() collapses to the desired single empty set).

a!flatten(
  a!forEach(
    property(local!activeTasks, "myProperty", null()),
    if(
      a!isNotNullOrEmpty(fv!item),
      fv!item,
      {}
    )
  )
)

omj2851
omj2851Author
July 23, 2024

actully data is coming from a task report.

out of which i need to filter that report data based on the value of a field

venkatrea696188
July 23, 2024

You are already using Query analytics to show it on the grid (You got the list here), Use Chaitanya's or Mike's Suggestion to index only the Notnull values out of the list. Did you stuck somewhere?? You want list of active tasks from local!activetasks where "C26" field is not null??