Page 1 of 1

using addFoundSetFilterParam to OR two dataproviders

PostPosted: Mon Apr 15, 2013 5:08 pm
by acho-bacho
Hi all,

how can I use addFoundSetFilterParam() to filter two different dataproviders using OR.
For example if I have a table called 'car' with fields 'make' and 'color'
I would want to filter the foundset as: filter all cars that are Renault or cars that are RED

How do I do that?
foundset.addFoundSetFilterParam('make', '=', 'Renault')
OR
foundset.addFoundSetFilterParam('color', '=', 'RED')


PS - do not buy a Renault

Re: using addFoundSetFilterParam to OR two dataproviders

PostPosted: Mon Apr 15, 2013 10:48 pm
by rgansevles
acho-bacho,

This is not supported, foundset-filters are always ANDed.

You can OR conditions using find/search or query builder, but these are not placed in the filter.

Rob

Re: using addFoundSetFilterParam to OR two dataproviders

PostPosted: Tue Apr 16, 2013 12:43 am
by mboegem
use the 'IN' operator:

Code: Select all
foundset.addFoundSetFilterParam('id', 'IN', "SELECT id FROM car WHERE make = 'renault' OR colour = 'red' ")