How can we fetch only not null cases from this index function.pls share the detailed query
Discussion posts and replies are publicly visible
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, {} ) ) )
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
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??
yes i need the records which dont have the null vales at c26 column of task report.
i tried the chataniya suggest but it didnt work.
i want list of active tasks from local!activetasks where "C26" field is not null
use that in where contains
index(local!activeTasks, wherecontains(chaitanya's code/Mike's,toint(local!activetasks.c26)),null)
your initial question said you just want to reject the nulls for the index you have mentioned, Hence mine and Mike's answers reflected.
index( local!activeTasks, wherecontains( reject( isnull(_), index(local!activeTasks, "c26", null) ) / Mike's approach, tointeger(local!activeTasks.c26) ), null )
My approach is already very easy to adapt for the use case of "get all rows where C26 is not null", and allows us to loop only once, instead of nesting together index() and whereContains() and index().
(As an aside, this is why it's important to phrase initial questions carefully and include relevant detail and/or information about your use case.)
The way I wrote it above just gets the "c26 values that are not null" but it is a very easy switch, as below:
a!flatten( a!forEach( local!activeTasks, if( a!isNotNullOrEmpty(property(fv!item, "C26", null())), fv!item, {} ) ) )