Using OnBuildQueryWhere

Hi all,

Some time ago I got information on how to use the OnBuildQueryWhere PHP Event to build a dynamic filter. I was able to get it to work, but had to leave it for another more urgent project. Just getting back to it and now I can't figure out how I did it<g>

Using $model->setQueryWhere['MyUniqueIdenitifer'] = "query";
with all sorts of permuations of colum name and table name + column name as well as just putting:

$model->setQueryWhere['MyUniqueIdenitifer'] = "1=2";

and there is never any filtering applied to the list.

Can someone please rattle my brain so I remember how this needs to be done?

Best regards,
Arnor
 
Hi guys,

Never mind, found it. I don't know where I found that setQueryWhere[] but the correct syntax is (as the tooltip on OnBuildQueryWhere states!)

$model->setPluginQueryWhere('MyUniqueIdenitifer',"Your Where clause here");

I am curious though exactly how unique the "MyUniqueIdentifier" needs to be. Not a big deal for me since I'm only applying this in one place and I've decided to use "ListNameIDxx" where the "ListName" is the name of the list without spaces, and then "ID" and the xx is the actual id of the list. So my unique ID is "ClientListID23"

Best regards,
Arnor
 
I am curious though exactly how unique the "MyUniqueIdentifier" needs to be

Unique doesn't really have any quantifiers. Unique means unique. If you use an identifier which is being used anywhere else, you'll overwrite the other one. But yes, your naming convention looks fine, unless you wind up with two copies of the same list on a page.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top