[ic] 2 questions: multifield searches & results sorting

Daniel Davenport ddavenport at newagedigital.com
Wed Jul 21 01:28:52 EDT 2004



> -----Original Message-----
> From: interchange-users-bounces at icdevgroup.org
> [mailto:interchange-users-bounces at icdevgroup.org]On Behalf Of Sergei
> Voyakin
> Sent: Monday, July 19, 2004 3:36 PM
> To: interchange-users at icdevgroup.org
> Subject: [ic] 2 questions: multifield searches & results sorting
>
>
> 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
> "]

Try this...

[loop random="[control matches 3]"
      search="
         fi=products
         sf=category
         se=[categoryVAR]
         sf=prod_group
         se=[prod_groupVAR]
         co=yes
         st=db
"]

The "co=yes" tells interchange to do a "coordinated" search; that is, it'll
match the first se= with the first sf=, the second with the second etc., and
return rows where everything matches.  In my experience (with v5.2.0, in
foundation-based catalogs), co=yes is NOT the default, and doing a search
without it may well return rows where any of the specified fields match any
of the specified values.  I haven't analyzed the results; i just know they
weren't what i wanted.  :)

BTW...in order for co=yes to work, there must be the same number of se's as
sf's.  You can't very easily search for prod_group X AND category (Y OR Z).
If you want that, you can either use SQL or split the search in two (at the
AND), and inner-loop over the first search, working only with values that
would satisfy the second.

/me



More information about the interchange-users mailing list