RE: Conditional Filters for Query module?
For saved searches filters are defined as arrays or arrays of arrays if you use complicated “AND”, “OR” operators.
In the new query module this is replaced with a function ex: myQuery.and(cond1, cond2 etc…)
With saved search filters you can simply conditionally push a filter into an array to include it in the search, is there a way to do so with the Query module? I’ve tried using “myQuery.and.apply(null, conditionsArray)” with no success
Try using this as the first argument
mainQuery.condition = mainQuery.and.apply(this, [Condition1, Condition2, Condition3])
worked for me
Actually I just tried null and that worked as well…can you provide more details about your query and what error you were getting? 🙂
Yeah I must have fat fingered something cause both are working for me today as well 🙂