I want filter out data from my data set array on basis of any like condition ?
Can i use reject function for that ? but how i will do this as its accepting first parameter as function.
reject(fn!isnull, {1, null, 3})
reject("*test*",local!dataset.fieldName) - Syntext might be incorrect but i want something like this
Discussion posts and replies are publicly visible
Hi sauravk (or any other person having a similar problem),I was looking for a solution to this problem and found the following solution:with( local!entries: {"gerd", "german", "manfred", "freddy"}, local!searchTerm: "man", filter( like(_, "*" & local!searchTerm & "*"), local!entries ))
For what it's worth, filter() can now basically be completely replaced with a!forEach() (just like apply() and most other looping functions other than reduce()). I recommend this approach in general because the coding of a!forEach() is a lot easier to understand both while initially creating logic, as well as for those who need to come around later and figure out what the original developer did.
a!localVariables( local!entries: {"gerd", "german", "manfred", "freddy"}, local!searchTerm: "man", a!forEach( local!entries, if( like(fv!item, "*" & local!searchTerm & "*"), fv!item, {} ) ) )