viewer-functions question. Lookup based on two separate conditions.

2 posts by 2 authors in: Forums > CMS Builder
Last Post: August 7, 2008   (RSS)

Re: [jpietrangelo] viewer-functions question. Lookup based on two separate conditions.

By Dave - August 7, 2008

Hi Jim,

The simplest way to do AND queries is to use search conditions in the url like this:
viewer.php?color=red&year_min=2000

There's docs for that here:
http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html

Next up, more advanced users who are comfortable with MySQL can do a custom where query like this:
'where' => " color = 'red' AND year <= '2000' ",

There's also some special fields that automatically get added to the where if they exist. They are: hidden, publishDate, removeDate, neverRemove. You can read about them here:
http://www.interactivetools.com/docs/cmsbuilder/special_fieldnames.html

So normally if you had a record with a field 'hidden' that was enabled there is no way you could display that record. The 'orWhere' lets you add a condition that is checked in addition to all the default and auto generated SQL. Generally it's only needed for very advanced situations.

Hope that helps. If there is something in particular you are trying to do and you need help with that just let me know.
Dave Edis - Senior Developer
interactivetools.com