Can someone explain the best use of filter function?
Discussion posts and replies are publicly visible
The documentation for filter() can be found over here - do you have any more specific questions?
,
Can this function be used to calculate the local variable local!output in my below piece of code?
a!localVariables( local!data:{{ id:1, value:"test", order:"new", active:true ),{ id:2, value:"qa", order:"old", active:false )} },
local!output:index(local!data, wherecontains(1,tointeger(local!data.id))),
local!output)
filter() is tricky (and in my opionion should be used only when necessary) since you need to call it either on a system function or on an expression rule if you need something more customized. For your use case (assuming i'm reading your code correctly), you would probably be better off using a!forEach().
For instance:
a!forEach( local!data, if( fv!item.id = 1, fv!item, {} ) )