Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
filtering listings

 

 


jtedescojam
User

Aug 29, 2009, 6:12 PM

Post #1 of 6 (1186 views)
Shortcut
filtering listings Can't Post

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


Chris
Staff


Aug 30, 2009, 9:03 AM

Post #2 of 6 (1177 views)
Shortcut
Re: [jtedescojam] filtering listings [In reply to] Can't Post

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:


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


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


jtedescojam
User

Aug 30, 2009, 9:56 AM

Post #3 of 6 (1172 views)
Shortcut
Re: [chris] filtering listings [In reply to] Can't Post

yeah that'll do it... thanks! (and yes, it was a duped request, I didn't think the first one went through)
John Tedesco
Creative Director

JAM Graphics


jtedescojam
User

Oct 13, 2009, 12:04 PM

Post #4 of 6 (1002 views)
Shortcut
Re: [jtedescojam] filtering listings [In reply to] Can't Post

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


Chris
Staff


Oct 14, 2009, 1:27 PM

Post #5 of 6 (995 views)
Shortcut
Re: [jtedescojam] filtering listings [In reply to] Can't Post

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:


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


I hope this helps. Please let me know if you have any questions.
Chris


jtedescojam
User

Oct 14, 2009, 2:03 PM

Post #6 of 6 (990 views)
Shortcut
Re: [chris] filtering listings [In reply to] Can't Post

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