[ic] 2 questions: multifield searches & results sorting

Ed LaFrance (New Media E.M.S.) ic_users at newmediaems.com
Mon Jul 19 16:51:57 EDT 2004


At 12:35 PM 7/19/2004, you wrote:

>I tried to do a search through google, but was not able to find a much...
>I want to do a search that searches for 2 diff values in 2 diff fields:
>For example, I have 2 prod_groups: prog_group1 & prod_group2 and i have 3 
>caregories: cat1, cat2, cat3.  So I want to find products that are in 
>prod_group1 AND cat 1 (or prod_group1 AND cat2, etc) or to say in sql language:
>SELECT * FROM PRODUCTS WHERE PROD_GROUP = 'prod_group1' AND category = 'cat1';
>(the prod_group values and category values are variables that I am passing in)
>I am searching for one this way:
>[loop
>     random="[control matches 3]"
>     search="
>          fi=products
>          sf=category
>          se=[categoryVAR]
>          st=db
>"]
>
>What is the correct sintax to do AND search as described above?
>
>Is this it?
>[loop
>     random="[control matches 3]"
>     search="
>          fi=products
>          sf=category, prod_groupinterchange-users at icdevgroup.org.
>          se=[categoryVAR], [prod_groupVAR]
>          st=db
>"]

Matched pairs of sf/se are logically and'ed by Interchange, so:

         sf=prod_group1
         se=[value p1]
         sf=category1
         se=[value c1]

is equivalent to the SQL "WHERE prod_group1 = 'some_value' AND category1 = 
'some_other_value'". Connecting multiple AND's with OR's is not as easy, I 
believe there is a syntax for it, but if you searches are getting that 
involved, I think you are better off rewriting them as SQL, and using an 
SQL DBMS to boot.

- Ed


===============================================================
New Media E.M.S.              Technology Solutions for Business
11630 Fair Oaks Blvd., #250   eCommerce | Consulting | Hosting
Fair Oaks, CA  95628          Ed.LaFrance at newmediaems.com
(916) 961-0446                http://www.newmediaems.com
(866) 519-4680 Toll-Free      (916) 961-0447 Fax
=============================================================== 



More information about the interchange-users mailing list