the beginning or the end. Best is to use the udf listfix:
http://www.cflib.org/udf.cfm/listfix
Pascal
> -----Original Message-----
> From: Neculai Macarie [mailto:[EMAIL PROTECTED]
> Sent: 01 September 2004 12:01
> To: CF-Talk
> Subject: [Spam?] Re: cfloop over csv not working with empty fields
>
> > Sorry - I don't understand how to include thin in my code, I have
found
> > something similar on the net, but I don't know how to incorporate a
> while
> > statement in my code as below:
>
> The code should look like this:
> <cfset CRLF = Chr(13) & Chr(10)><!--- Linefeed & carriage return --->
>
> <cffile action="" file="#ExpandPath('/pharma/uploads')#/Book1.csv"
> variable="csvData">
>
> <cfset csvData = Replace(csvData, ",,", ", ,", "ALL") >
>
> <cfloop index="csvRecord" list="#csvData#" delimiters="#CRLF#">
>
> <cfset csvArray = ArrayNew(1)>
> <cfset csvCellCount = 1>
> <cfloop index="csvCell" list="#csvRecord#" delimiters=",">
>
> <cfset csvArray[variables.csvCellCount] = Trim(csvCell)>
> <cfset csvCellCount = csvCellCount + 1>
>
> </cfloop>
>
> <cfdump var="#csvArray#">
>
> </cfloop>
>
>
> Empty list elements are replaced with elements with a space in them
before
> the loop
> begins. And inside the loop you need to Trim the cell content before
> putting it into
> the array (you could make a <cfif csvCell eq ' '>cell is
> empty<cfelse><cfset
> csvArray[variables.csvCellCount] = csvCell> if you care about spaces
at
> the start
> and end of a cell content).
>
> --
> <mack />
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

