filtering listings

6 posts by 2 authors in: Forums > CMS Builder
Last Post: October 14, 2009   (RSS)

By jtedescojam - August 29, 2009

I know how to filter records using 'where' in the 'top viewer code'... for example... if I want to display all listings where the color is blue. However I am having difficulty figuring out an additional filter to display all listings where the color is blue and the size is large.

so any record where the site is small and blue, it won't show... and a record that is large and red, it won't show. You get the idea....

Using the filter in the URL can't work for what I'm using this for... it needs to be in the viewer code. Here's what I have so far:

'where' => "color = 'blue' AND size <= 'large' ",

the page works, but it's not filtering the second variable - size=large.
John Tedesco

Creative Director



JAM Graphics

Re: [jtedescojam] filtering listings

By Chris - August 30, 2009

Hi jtedescojam,

<= means less-than-or-equal-to, which usually doesn't make sense unless you're talking about numbers. You probably want a straight equality test:

'where' => "color = 'blue' AND size = 'large' ",

Hope this helps! Please let us know if you have any more questions or comments.
All the best,
Chris

Re: [jtedescojam] filtering listings

By jtedescojam - October 13, 2009

This works perfectly for everything... except for some reason it doesn't work when it's set for multiple checkboxes??? Any ideas... the following code works fine when it's set for 'pull down'

'allowSearch' => '0',
'where' => "event_type = 'Corporate Events'",

does not work when it's set for checkboxes.
John Tedesco

Creative Director



JAM Graphics

Re: [jtedescojam] filtering listings

By Chris - October 14, 2009

Multi-value list fields are stored a little differently. They're stored as a list of tab-separated values, so you need to use LIKE:

'allowSearch' => '0',
'where' => "event_type LIKE '%\tCorporate Events\t%'",


I hope this helps. Please let me know if you have any questions.
All the best,
Chris

Re: [chris] filtering listings

By jtedescojam - October 14, 2009

You guys are awesome... I hope you never get too big that your response time and personal assistance lags.
John Tedesco

Creative Director



JAM Graphics