this bit is the wrong bit:

<cfif ListLast(attributes.journoid) NEQ d>, </cfif>

listlast returns the value of the final index of a list. 

so listlast('1,2,3,4') returns '4'

when looping over a list, the index variable (here you're using 'd') gives
you the position of that index.

ie <cfloop list="apple,banana,cat,pomegranate,squirrel fishing,wombats"
index="d"><cfoutput>#d#,</cfoutput></cfloop>

won't give you the actual values 'apple' etc, it'll give you '1,2,3' etc

perhaps you want this (using listlen()):

<cfif Listlen(attributes.journoid) NEQ d>, </cfif>

if your lists contain numeric values only (which I suspect judging by their
names) then why don't you just do this:

WHERE journoid IN (#attributes.journoid#)

?


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: 27 January 2003 16:22
> To: [EMAIL PROTECTED]
> Subject: Re: [ cf-dev ] Spot the problem - IN()
> 
> 
> 
> is there some sort of issue with your list delimiters?  Maybe 
> specify what
> these are in your ListLast function.
> 
> 
> Duncan Cumming
> IT Manager
> 
> http://www.alienationdesign.co.uk
> mailto:[EMAIL PROTECTED]
> Tel: 0141 575 9700
> Fax: 0141 575 9600
> 
> Creative solutions in a technical world
> 
> ----------------------------------------------------------------------
> Get your domain names online from:
> http://www.alienationdomains.co.uk
> Reseller options available!
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> 
> 
> 
>                                                               
>                                                      
>                     Dave Phipps                               
>                                                      
>                     <dave@phipps-        To:     ColdFusion 
> User group <[EMAIL PROTECTED]>               
>                     cf.co.uk>            cc:                  
>                                                      
>                                          Subject:     [ 
> cf-dev ] Spot the problem - IN()                           
>                     01/27/03                                  
>                                                      
>                     04:12 PM                                  
>                                                      
>                     Please                                    
>                                                      
>                     respond to                                
>                                                      
>                     dev                                       
>                                                      
>                                                               
>                                                      
>                                                               
>                                                      
> 
> 
> 
> Hi,
> 
> I am running into a problem with a query that is looking at a 
> list to get
> the records for items in the list.  I have three queries all 
> running very
> similar code and the last query is not putting the comma in 
> between the
> list items and therefore is returning no records.
> 
> The line of code is:
> 
> WHERE journoid IN (<cfloop index="d"
> list="#attributes.journoid#">'#d#'<cfif 
> ListLast(attributes.journoid) NEQ
> d>, </cfif></cfloop>)
> 
> In the debug I see the two journoid values listed but without a comma
> separating them.
> 
> I have another query which uses this code:
> WHERE journoNatOpt.natOptid IN(<cfloop index="c"
> list="#valuelist(storyNatOpt.natOptid)#">'#c#'<cfif
> ListLast(valuelist(storyNatOpt.natOptid)) NEQ c>, </cfif></cfloop>)
> 
> As you can see there is not a great deal of difference between the two
> lines except that the first one does not work.
> 
> Can anyone spot what I have missed?
> 
> Cheers
> 
> Dave
> 
> 
> --
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to