It sounds like it's a simple as:
<cfif ListFindNoCase(get_tobacco.tobaccoContents,get_content.ContentsID)>,
if you only need to look at one record from get_tobacco,
If you need to compare to all record, try:
<cfif
ListFindNoCase(ValueList(get_tobacco.tobaccoContents),get_content.ContentsID
)>
Bob
-----Original Message-----
From: Jon Tillman [mailto:[EMAIL PROTECTED]]
Sent: March 19, 2001 9:24 AM
To: CF-Talk
Subject: Re: selecting multiple records in a select box
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
What it returns is something like:
get_tobacco.tobaccoId = 1
get_tobacco.tobaccoContents = '2, 4, 5, 7'
I am comparing get_tobacco.tobaccoContents and get_content.ContentsID,
hopefully.
On Monday 19 March 2001 09:13 am, you wrote:
> Does get_tobacco contain an ID field? If you're comparing two sets of
> ID's, my CF_Venn tag can do that:
>
> CF_Venn ListA="#ValueList(Contents.ContentsID)#"
> ListB="#ValueList(get_tobacco.theID)#" AandB="matches">
>
> The heart of the relevant code is simply:
> <cfset AandB = "">
> <cfloop list="#ListA#" index="Elt">
> <cfif ListFindNoCase(ListB,Elt)>
> <cfset AandB = ListAppend(AandB,Elt)>
> </cfif>
> </cfloop>
>
> -David
>
> On Monday, March 19, 2001 5:35 AM, Jon Tillman
> [SMTP:[EMAIL PROTECTED]]
>
> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > I have a string of numbers, seperated by commas, stored in a text field
> > in a table, call it tblItem.
> > These numbers each correspond to a primary key in tblContent.
> > I build a select box by looping over all the primary keys in tblContent,
> > like
> >
> > this:
> >
> > <cfquery name="get_content" datasource="#application.dsn#">
> > SELECT *
> > FROM TblContent
> > </cfquery>
> >
> > <td><select name="Contents" size="5" multiple>
> > <cfoutput query="get_content">
> > <option value="#ContentsID#">#ContentsName#</option>
> > </cfoutput>
> > </select>
> > </td>
> >
> > Now, what I want to do is to add a bit of code to this that will check
> > for a match between the ContentsID from my option and any of the values
> > in the string from this query:
> >
> > <cfquery name="get_tobacco" datasource="#application.dsn#">
> > SELECT *
> > FROM tblItem
> > WHERE ItemID = #url.ITEM#
> > </cfquery>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists