Thanks, I will have a look at it this evening when I have access to my
test files.  Now that is the one that requires the jar file to be
installed on the server?  This is for CFMX, was hoping to avoid
needing to have anything installed on the server since our data center
really fights doing anything out of the "norm"

-- 
Aaron Rouse
http://www.happyhacker.com/

On Tue, 7 Dec 2004 10:08:21 -0500, Dave Carabetta <[EMAIL PROTECTED]> wrote:
> On Tue, 7 Dec 2004 09:00:22 -0600, Aaron Rouse <[EMAIL PROTECTED]> wrote:
> 
> 
> > I have a CSV file that I need to build a web interface for uploading
> > into our Oracle database.  One of the things I noticed is this data
> > has a CR within it, such as blah,1,12042004,"this has a CR right
> > here[]and then more text",blahblah,45 ... and each line ends with a
> > CR.  I was wanting to use some of the methods(java.io.StringReader and
> > java.io.BufferedReader) that I have seen posted on the list recently,
> > just to learn another way but these CRs are throwing things off.  Best
> > I can tell the readLine() function that is part of the BufferedReader
> > gets to that CR that is with double quotes and sees it as a new line.
> > Would there be some way to make it overlook this?
> >
> > Here is some example code, this was taken directly from a function
> > recently posted to the list:
> >
> > <cfscript>
> >  var linesArray = ArrayNew(1);
> >  var jReader = 
> > createObject("java","java.io.StringReader").init(arguments.inString);
> >  var jBuffer = createObject("java","java.io.BufferedReader").init(jReader);
> >  var line = jBuffer.readLine();
> > </cfscript>
> >
> > <cftry>
> >  <!---
> > Unlike Java, CFML has no notion of null, but this is quite a special
> > case.   Whenever readLine() reach the end of the file, it return a
> > Java null,  as soon as   the  BufferedReader return null, ColdFusion
> > "erase" the line variable,  making it undefined.        Here we leverage
> > this somewhat weird behavior by using it as test condition for the
> > loop
> >  --->
> > <cfloop condition="#IsDefined("line")#">
> >  <cfset ArrayAppend(linesArray, line)>
> >  <cfset line=jBuffer.readLine()>
> > </cfloop>
> >
> > <cfset jBuffer.close()>
> > <cfcatch type="any">
> > <!---
> > Something went wrong; we better close the stream anyway, just to be
> > safe and leave no garbage behind
> > --->
> >  <cfset jBuffer.close()>
> >  <cfthrow message="tmt_csv: Failed to read lines from string" 
> > type="tmt_csv">
> > </cfcatch>
> > </cftry>
> > <cfreturn linesArray>
> >
> 
> I've had great success with the ostermiller utilities below. It has
> handled lots of different CSV issues with ease and is very easy to use
> if you're using CFMX:
> 
> http://ostermiller.org/utils/CSV.html
> 
> Regards,
> Dave.
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - RUWebby
http://www.ruwebby.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186454
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to