rather than use arraytolist(), try using valuelist(query.column) and see
what that gives you...

> -----Original Message-----
> From: Ian Westbrook [mailto:[EMAIL PROTECTED]
> Sent: 10 June 2003 11:46
> To: cfug dev list
> Subject: [ cf-dev ] ArrayToList
> 
> 
> Hi
> got pissed on red wine last night, so head not very clear...
> 
> y'all may remember that the other day I did an ArrayToList:
> 
>  <cfquery datasource="#dsn#" name="userartforms">
>  SELECT artformid
>  FROM artformjoin
>  WHERE userid = #session.userid#
>  </cfquery>
> 
>  <cfoutput>
>  <cfset myartforms = ArrayToList(#userartforms.artformid#, ',')>
>  </cfoutput>
> 
> which all worked fine.
> 
> so why the hell isn't this working:
> 
> <cfquery datasource="#dsn#" name="userartforms">
> SELECT artformjoin.userid, artformjoin.artformid, 
> artforms.id, artforms.artform 
> FROM artformjoin, artforms
> WHERE artformjoin.userid = #session.userid#
> AND artformjoin.artformid = artforms.id
> ORDER BY artformjoin.artformid
> </cfquery>
> 
> <cfif userartforms.RecordCount IS NOT 1> // RC is 4 for test 
> data - see below, and RC will always be at least 1 as the 
> user has to choose at least 1 artform during registration
> 
> <cfoutput>
> <cfset myartforms = ArrayToList(userartforms.artformid, ',')>
> </cfoutput>
> 
> <cfquery datasource="#dsn#" name="getevents">
> SELECT id
> FROM diary
> WHERE artform IN (#myartforms#)
> </cfquery>
> 
> <cfelse>
> 
> <cfquery datasource="#dsn#" name="getevents">
> SELECT id
> FROM diary
> WHERE artform = #userartforms.artformid#
> </cfquery>
> 
> </cfif>
>  
> error message:
> 
> An error has occurred. 
> 
> An error occurred while evaluating the expression: 
> 
> 
>  myartforms = ArrayToList(userartforms.artformid, ',')
> 
> 
> Error near line 15, column 7. 
> --------------------------------------------------------------
> ------------------
> 
> Parameter 1 of function ArrayToList which is now "8" must be 
> an indexed object such as an array or a query column 
> 
> 
> I did some error-checking with this code:
> 
> <cfoutput>
> RC: #userartforms.RecordCount#
> </cfoutput>
> <br><br>
> <cfoutput>
> #userartforms.artformid#, 
> </cfoutput>
> <cfabort>
> 
> which output: 
> RC: 4 
> 
> 8, 
> 
> so only the first item of the array is coming out (there 
> should be 4 elements, as the RC correctly picked up).
> 
> anyone any ideas?
> 
> I was having a good morning, too... ;-)
> 
> TIA
> 
> Ian W
> 
> 
> Ian Westbrook,
> FutureDream Media Limited,
> (W): www.futuredream.net
> (E): [EMAIL PROTECTED]
> (T): +44 (0) 1303 258 985
> (M): 07939 510 812
> 
> This message may contain information which is legally 
> privileged and/or confidential. If you are not the intended 
> recipient, you are hereby notified that any unauthorised 
> disclosure, copying, distribution or use of this information 
> is strictly prohibited. Such notification notwithstanding any 
> comments, opinions, information or conclusions expressed in 
> this message are those of the originator, not of FutureDream 
> Media Ltd, unless otherwise explicitly and independently 
> indicated by an authorised representative of FutureDream Media Ltd.
> 


-- 
** 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