ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old September 19th, 2003, 02:06 PM
stelly stelly is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 4 stelly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 14 sec
Reputation Power: 0
Question cfloop list doesn't return null values

I have a list like ",89,90,,87". When I use cfloop go to through it, I only get 3 values instead of 5 with 2 nulls. How do I specify the <cfloop> tag to return 5?

I want to have something like this:
<tr><td></td><td>89</td><td>90</td><td></td><td>87</td></tr>

Instead, I get this:
<tr><td>89</td><td>90</td><td>87</td></tr>

Thanks in advance for any help!

Stelly

Reply With Quote
  #2  
Old September 21st, 2003, 07:43 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
The unfortunate answer is there is no way to get CFLOOP to do this on its own. CF treats multiple null delimiters as one delimiter, which is a benefit in some situations and a pain in the butt in others. You could either send the string in with spaces between the delimiters, or run a replace function that adds a space after each delimiter, but then you must remember to trim() the value when you use it, like this:

<cfset list = "1,2,3,,5,,,,9,10">
<cfset counter = 0>

<cfoutput>
<cfloop index="thisElement" list="#replace( list, ',', ', ', 'All' )#" delimiters=",">
<cfset counter = counter + 1>
Element #counter#: #trim( thisElement )#<br>
</cfloop>
</cfoutput>

A custom tag or function could also handle this pretty easily.

Reply With Quote
  #3  
Old September 22nd, 2003, 11:31 AM
stelly stelly is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 4 stelly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 14 sec
Reputation Power: 0
Smile

Thanks for the tip!

Stelly

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > cfloop list doesn't return null values


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway