[ic] Help? - Search new table from flypage

interchange-users@interchange.redhat.com interchange-users@interchange.redhat.com
Wed May 29 15:31:01 2002


> This is sort of a reverse of the scenario I was asking about before -- but not quite. (Always wishing it were that easy!)
> 
> In products.txt I have a field named "ingredients" which contains a comma-delimited list of ingredients for each product. 
> 
> I also have a table named glossary.txt which contains the ingredients with their definitions. Fields: "code", "word", 
> "definition". I have a separate search page for the glossary, as well as a unique results page, "glossary_results.html".
> 
> From the flypage, the user should be able to click on one of the listed ingredients, which would bring up a search result 
> (glossary_results.html) in a new window.
> 
> Easy to do if there were only one ingredient for each product - but how do I have IC trigger a search on each 
> comma-delimited item in the field (eg. [field "ingredients":] Water, Ammonium Lauryl Sulfate, Cocamidopropyl Betaine, 
> Coco Glucoside)? I'd be happy with a select box, but would prefer text links.
> 
> Thanks again in advance. As I become a more experienced IC user, I do hope to someday return the favour!  
> 

Kevin Walsh wrote: ------------
You could do it several ways.  Here are a couple of them:

  1) A small block of Perl to split the ingredients into a list of links.
     Each link would point at a glossary entry.

  2) A separate "ingredients" table that links each product each ingredient
     and possibly allows reverse linking where you could search on "water"
     and get a list of products that contain that ingredient. :-)

     The ingredients table would only need two columns (SKU and ingredient)
     to create a many-to-many association table.

     The product page could perform a query on the ingredients table and
     get a list appropriate for that product.  Links could be generated
     to a glossary from there.  The glossary would look like what you
     described as your ingredients.txt, above.
-----------------

Thanks!

So, you're suggesting I should make a new table -in addition to glossary.txt- called ingredients.txt? Forgive me if this is a simple-minded question, but if I already have a field for ingredients in products.txt - which means a list of ingredients is already being generated on the product page - why is this necessary?

I actually do have the glossary listings linking to the products (eg. clicking on "water" pulls up all of the products that contain that ingredient): 

<a href="[area search="se=[my-data glossary word]"]">[my-data glossary word]</a>

Now, of course, I'm attempting to turn this around so that I can get a lookup in glossary.txt from the product page. 

With my existing setup, is there a query I can run from the product page that will achieve this? (Right now really wishing I could code Perl!)

You guys are awesome. Thanks a million.
Lara


__________________________________________________________
Get your FREE personalized e-mail at http://www.canada.com