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:

while(find(",,",csvRecord)) csvRecord = Replace(csvRecord, ",,", ", ,",
"ALL")

this is what I need to use I think but I don't know where to put it in my
code below:

<cfset CRLF = Chr(13) & Chr(10)><!--- Linefeed & carriage return --->

<cffile action="" file="#ExpandPath('/pharma/uploads')#/Book1.csv"
variable="csvData">

<cfloop index="csvRecord" list="#csvData#" delimiters="#CRLF#">

            

     <cfset csvArray = ArrayNew(1)>

     <cfset csvCellCount = 1>

     <cfloop index="csvCell" list="#csvRecord#" delimiters=",">

            

                        <cfset csvArray[variables.csvCellCount] = csvCell>

        <cfset csvCellCount = csvCellCount + 1>  

     </cfloop>

     <cfdump var="#csvArray#">

</cfloop>

  _____  

From: Neculai Macarie [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 1 September 2004 7:35 PM
To: CF-Talk
Subject: Re: cfloop over csv not working with empty fields

> Hi - just wondering how to go about looping over a list generated from a
csv
> file that has empty fields, ie, 1,2,3,4,,6,7

Replace your empty fields with spaces and then Trim the spaces when you put
the
fields in the array:

Replace(csv_var, ",,", ", ,", "ALL")

--
<mack />

  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to