this should be close)
<cfset cfList = "a,b,,d">
<cfset cfList = Replace(cfList, ",,", ", ,","All")>
<cfif left(cfList,1) EQ ",">
<cfset cfList = " #cfList#">
</cfif>
<cfif right(cfList,1) EQ ",">
<cfset cfList = "#cfList# ">
</cfif>
<cfloop index="e" list="#cfList#">
<cfoutput>
<cfif len(trim(e))>#e#<cfelse>Empty Element</cfif>
</cfoutput>
</cfloop>
HTH,
Duane
_____
From: Chunshen (Don) Li [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 30, 2004 10:27 AM
To: CF-Talk
Subject: The infamous LIST again!
SET LIST VALUE:
<cfset cfList = "a,b,,d">
<cfloop index="e" list="#cfList#">
<cfoutput>
#e#
</cfoutput>
</cfloop>
Three out of the above FOUR list elements would be displayed.
No, my application requires more complexity than the above example. The
point is, I need a "NO VALUE STRING" for the third element even if it's
EMPTY instead of conveniently ignoring it. An attempt to convert the list
to an Array,
<cfset cfList = "a,b,,d">
<cfset anArray4List = ListToArray(cfList)>
<cfset cnt = 0>
for argument sake, use plain 4 items here
<cfloop index="e" from=1 to=4>
<cfset cnt = cnt + 1>
<cfoutput>
#anArray4List[cnt]#
</cfoutput>
</cfloop>
Failed to achieve what is intended. It seems that the ListToArray function
converts the 3 elements to an array.
What's your way to circumvent this problem?
TIA.
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]