using addFoundSetFilterParam to OR two dataproviders

Questions and answers regarding general SQL and backend databases

using addFoundSetFilterParam to OR two dataproviders

Postby acho-bacho » Mon Apr 15, 2013 5:08 pm

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
acho-bacho
 
Posts: 8
Joined: Fri Oct 07, 2011 1:17 pm

Re: using addFoundSetFilterParam to OR two dataproviders

Postby rgansevles » Mon Apr 15, 2013 10:48 pm

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
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: using addFoundSetFilterParam to OR two dataproviders

Postby mboegem » Tue Apr 16, 2013 12:43 am

use the 'IN' operator:

Code: Select all
foundset.addFoundSetFilterParam('id', 'IN', "SELECT id FROM car WHERE make = 'renault' OR colour = 'red' ")
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 10 guests