This may be an example of what you are looking for:
===
Qry: Populate_job_Function - selects possible codes and descriptions - codes
are comma delimited in tbl: gt_resumes.discipline field in Qry:
Demographic_display
===
<cfquery name="Populate_job_Function" datasource="mpa1" >
select code, description from gen_tables where table_name='functions'
order by description
</cfquery>
===
<cfquery name="Demographic_display" datasource="mpa1">
select discipline from gt_resumes
where gt_resumes.id=#client.id#
</cfquery>
===
checks tbl: gt_resumes.discipline field for values in tbl: gen_tables and
returns corresponding descriptions
===
<cfloop QUERY="Populate_job_function" >
<cfset checkindex=#checkindex#+1>
<cfif #checkindex# eq 1>
<cfif
listfind(#Demographic_display.discipline#,#Populate_job_Function.code#) gt
0>
#populate_job_function.description#;
</cfif>
<cfelse>
<cfif
listfind(#Demographic_display.discipline#,#Populate_job_Function.code#) gt
0>
#populate_job_function.description#;
</cfif>
<cfset checkindex=0>
</cfif>
</CFLOOP>
JoAnn A. Schlosser
Senior Consultant
Association Management Software
Grant Thornton LLP
Washington, D. C.
703.837.4428
-----Original Message-----
From: DeVoil, Nick [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 5:34 AM
To: CF-Talk
Subject: RE: Looping through lists
Chris,
This isn't what you want to hear, but really your database design
needs changing so that each keyword is in a separate row.
If that's not an option, you could read the list of keywords
and do a ListFindNoCase() on it. That will be incredibly slow though,
if you do it for every entry in a large database.
Nick
-----Original Message-----
From: Chris Geanious [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 5:01 AM
To: CF-Talk
Subject: Looping through lists
Greetings,
Am constructing a db search using (among other things) a form text area for
keywords. In the data base there is a KeyWords field which contains a
comma delimited list of keywords for each entry.
I have a query which loops over the form text box entries. How do I then
loop over the database keyword fields to check for a match? I am a little
stuck. Any suggestions, code snippets, links to sites would be greatly
appreciated.
TIA,
Chris
==============================
Chris Geanious
Support Systems Analyst Senior
Institute For Human Development
Northern Arizona University
**********************************************************************
Information in this email is confidential and may be privileged.
It is intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system.
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone.
Thank you for your co-operation.
**********************************************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists