To get a comma delimited list of column values just do:
#valuelist(qry_show_event_sponsors.eventsponsername)#
As an alternative try:
<cfscript>
for(i=1;i lt qry_show_event_sponsors.recordcount;i=i+1)
writeoutput(qry_show_event_sponsors.eventsponsername[i]&', ');
writeoutput(qry_show_event_sponsors.eventsponsername[qry_show_event_sponsors
..recorcount]);
</cfscript>
-----Original Message-----
From: Semrau, Steven L Mr SRA
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 2:18 PM
To: CF-Talk
Subject: RE: Finding the last item in a loop
Yes, use the qry_show_event_sponsors.recordCount to get the amount of
records your query returned and do a compare. So you would have something
like:
<cfset x=0>
<cfloop query="qry_show_event_sponsors">
<cfset x = x+1>
#EventSponserName#<cfif x NEQ
qry_show_event_sponsors.recordCount>,</cfif>
</cfloop>
Hence, if x doesn't equal the query record count, insert the comma.
Steven Semrau
SRA International, Inc.
Senior Member, Professional Staff
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Com: (703) 805-1095
DSN: (703) 655-1095
-----Original Message-----
From: Chris Martin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 11:13 AM
To: CF-Talk
Subject: Finding the last item in a loop
IS it possible to find the last item in a loop?
Right now I have this:
<cfloop query="qry_show_event_sponsors">
#EventSponserName#,
</cfloop>
Is it possible to check if the #EventSponsorName# is the last item in the
record set, and then not display the comma? I.E.
<cfloop query="qry_show_event_sponsors">
#EventSponserName#<cfif something>,</cfif>
</cfloop>
Thanks in advance
Chris Martin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists