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:
  #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 Specialist (4000 - 4499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 4,084 kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 10 h 42 m 46 sec
Reputation Power: 780
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



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT