Replace all the delimiters in the list with <space><delimiter><space>.
Then use Trim() to get rid of the extra spaces.

<cfset List = ",2,3,4,  , ,7,,9,,,,13,,,">
<cfoutput>
Original List: #List#<br><br>
<cfset List = Replace(List, ",", " , ", "all")>
<cfloop index="i" from="1" to="#ListLen(List)#">
  Item ## #i#: #Trim(ListGetAt(List, i))#<br>
</cfloop>
</cfoutput>


Jim


-----Original Message-----
From: Aidan Whitehall <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Saturday, September 16, 2000 6:00 AM
Subject: Null values within lists


>If you have a list like this
>
>1,2,3,,5,6
>
>is there any way of getting ListGetAt(List, 4) to return "" and not
"5"?
>
>
>Reason:
>A client is going to supply data in a comma delimited text file, one
>record per line. A template will populate several database tables from
>that file. Each record is stored on a different line.
>
>In fields such as Address1, Address2, Address3, there will be empty
>values in some records. I was going to write the query in a CFLOOP,
>something like:
>
>INSERT INTO Site (Name, Address1, Address2, Address3, etc)
>VALUES ('#ListGetAt(List, 1)#', '#ListGetAt(List, 2)#',
>'#ListGetAt(List, 3)#', '#ListGetAt(List, 4)#', etc)
>
>But if, for example, Address3 is blank, ListGetAt(List, 4) returns the
>value that should go in the next field (Town), ie the fifth element in
>the list.
>
>If ListGetAt returned null values from a list, this wouldn't be a
>problem.
>
>
>
>Thanks in advance
>
>--
>Aidan Whitehall  <[EMAIL PROTECTED]>
>The Net Profits Internet Services
>ColdFusion website development, domain names, hosting and tuition
>Tel: +44 (0) 1695 50050  (North West England)
>
>-----------------------------------------------------------------------
-------
>Archives: http://www.mail-archive.com/[email protected]/
>To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to