RE: Revised Thread - Uploading CSV and Validation

2005-01-11 Thread Tim Blair
Treat it as two lists. The first using Chr(13) or Chr(10) as a delimiter, the second using ,: The only problem you'll get with that is if the CSV contains a record like the following (which is perfectly valid): 1,Banana,Long and yellow, with a slight bend As CF list functions would see it,

Re: Revised Thread - Uploading CSV and Validation

2005-01-11 Thread Dave Carabetta
On Mon, 10 Jan 2005 20:06:12 -0600, Aaron Rouse [EMAIL PROTECTED] wrote: And if using Oracle you could use SQLLDR. I have the need to do this just with CF and been using a CFC I got off this list for uploading it but still have not found the time to really progress with it. On Mon, 10 Jan

RE: Revised Thread - Uploading CSV and Validation

2005-01-11 Thread Tim Blair
2) Use the awesome Ostermiller utilities at http://ostermiller.org/utils/CSV.html to actually parse the CSV file Hmm, excellent resource. One to bookmark I think! Cheers Dave. Tim. -- --- Badpen Tech - CF and web-tech:

RE: Revised Thread - Uploading CSV and Validation

2005-01-11 Thread Ben Rogers
CSVs are much trickier than a lot of people realize to handle in my experience. For example, there are two separate CSV formats -- one the world uses and one Microsoft uses. Actually, there is no standard for CSV. There are just about as many formats as there are implementations. Consequently,

Re: Revised Thread - Uploading CSV and Validation

2005-01-11 Thread Jochem van Dieten
Ken wrote: Hi. I want to enable the user to upload a csv file, then the data should be validated against pre-defined criteria for different columns in the csv file. Once that is done, I want to write the validated rows from the csv file to the DB. I would change the process a bit. Don't

Re: Revised Thread - Uploading CSV and Validation

2005-01-11 Thread Aaron Rouse
The carriage return within a cell is actually the problem I ran into and never looked back at what I will do to work past it. This requirement is kind of low on my list of things to get done so just keeps moving towards the back burner. The data I have is populated into an Excel spreadsheet and

Re: Revised Thread - Uploading CSV and Validation

2005-01-11 Thread Dave Carabetta
On Tue, 11 Jan 2005 11:11:27 -0500, Ben Rogers [EMAIL PROTECTED] wrote: CSVs are much trickier than a lot of people realize to handle in my experience. For example, there are two separate CSV formats -- one the world uses and one Microsoft uses. Actually, there is no standard for CSV.

RE: Revised Thread - Uploading CSV and Validation

2005-01-11 Thread Ben Rogers
Which further emphasizes my point that basic ColdFusion solutions of looking for carriage returns and the like is not a robust way to solve this problem. I wasn't debating that point. However, it's worth noting that this is entirely dependent on the application which generated the CSV file. If

Re: Revised Thread - Uploading CSV and Validation

2005-01-11 Thread Dave Carabetta
On Tue, 11 Jan 2005 12:35:56 -0500, Ben Rogers [EMAIL PROTECTED] wrote: Which further emphasizes my point that basic ColdFusion solutions of looking for carriage returns and the like is not a robust way to solve this problem. I wasn't debating that point. However, it's worth noting that

RE: Revised Thread - Uploading CSV and Validation

2005-01-11 Thread Ben Rogers
Agreed. For the record, it looks like Excell (I'm using 2003) does indeed allow carriage returns. I just ran a quick test (when in the cell, hit Alt+Enter to start a new line within it) and it saved out with the carriage return. Good to know. Thanks for testing. That wasn't my point at all.

Re: Revised Thread - Uploading CSV and Validation

2005-01-11 Thread Larry White
I was just providing a method using carriage returns and lists, not the entire code. It's fairly simple to find out if the data delimiters are correctly interpreted, or embedded in the data since the list lengths (fields) will be wrong. Those that don't match the field count can be saved to

Revised Thread - Uploading CSV and Validation

2005-01-10 Thread Ken
Hi. I want to enable the user to upload a csv file, then the data should be validated against pre-defined criteria for different columns in the csv file. Once that is done, I want to write the validated rows from the csv file to the DB. Please help. Thanks, Ken

Re: Revised Thread - Uploading CSV and Validation

2005-01-10 Thread Larry White
Treat it as two lists. The first using Chr(13) or Chr(10) as a delimiter, the second using ,: cfset CSV = CSVFileData cfloop index=idx List=#CSV# delimiters=#chr(13)# cfset Firstcolumn = ListGetAt(idx,1) cfset SecondColumn = ListGetAt(idx,2) Continue for all columns and validate Insert into

Re: Revised Thread - Uploading CSV and Validation

2005-01-10 Thread Paul Malan
If you're using SQL Server, you can create a DTS package then call it from CF. I couldn't believe the difference in speed when I switched to DTS. (If you need to use CF to validate the incoming data, use DTS to populate a temp table, CF to pull it out and insert the validated data into its

Re: Revised Thread - Uploading CSV and Validation

2005-01-10 Thread Aaron Rouse
And if using Oracle you could use SQLLDR. I have the need to do this just with CF and been using a CFC I got off this list for uploading it but still have not found the time to really progress with it. On Mon, 10 Jan 2005 16:53:15 -0700, Paul Malan [EMAIL PROTECTED] wrote: If you're using SQL