View Full Version : OR'ing search criteria
alienationdesign
06-27-2007, 03:19 PM
I can create a url to filter table entries on one criteria but we need to be able to search on "field[value]=1 or field[value]=2"
Is this sort of combination supported in any way or will we have to tweak the php?
[using Fabrik 1.0.4]
alienationdesign
06-28-2007, 05:36 PM
No takers? I'll try explaining a different way.
My form has 4 drop down menus - A B C D.
Submitting the form returns data matching A AND B AND C AND D
I would like to perform a search returning data matching A OR B OR C OR D
I was thinking the or search could be facilitated by selecting a checkbox in the form, is this kind of thing possible or would I need to modify the raw code to be able to do this?
Thanks
Hi
You will need the lastest version from the SVN to do this (revison 42)
Then you can do this in your query string:
index.php?option=com_fabrik&Itemid=35&jos_users___id[value][]=62&jos_users___id[value][]=63
alienationdesign
07-02-2007, 01:18 PM
Thanks for getting back to me (again :P),
If i type the array reference you mention into the url then the 'or' search is performed, but how/where in fabrik would I enter this reference so that the 'or' search is performed on submission of the form?
Heres the initial URL as a result of the fabrik form submission
?option=com_fabrik&Itemid=86&skills=1&skills[value]=1&jobtype=1&jobtype[value]=1&_frommodule=1
and heres the URL after me adding in the []
?option=com_fabrik&Itemid=86&skills=1&skills[value][]=1&jobtype=1&jobtype[value][]=1&_frommodule=1
Alternatively is it possible to add a clause somehow to run the OR search as a result of someone ticking a checkbox? Ideally I would want to run an AND search by default and run an OR search if required, i.e. when the checkbox is selected
Incidentally the following error occurs when you try adding the array reference to the url
"Warning: urldecode() expects parameter 1 to be string, array given in /home/qlradmin/public_html/components/com_fabrik/fabrik_table.class.php on line 440"
Should be able to get round that one but thought I would mention it
Thanks
Hi
Theres currently no gui method for selecting whether the filters use and or or.
I've had a think about adding it in under the elements "table data" tab but the problem is that i think it would be confusing for people to understand in which order and grouping the and/ors would be applied.
e.g.
select * from table where colA = 1 and colbB = 2 or colC = 3
is different from
select * from table where (colA = 1 and colbB = 2) or colC = 3
and from
select * from table where colA = 1 and (colbB = 2 or colC = 3)
Really the creation of filters need to allow for each of these situations, and be design in a way that easly allows their creation and comprehension. However thats quiet a big task so wont make it into the 1.0.4 release which is what I'm trying to get out the door.
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.