CSV to Recordlist

CSV to Recordlist

  
Hi! 

I have a CSV file and i am trying to make it into a record list. the problem occurs when a value inside the csv also contains a comma and sometimes it would contain 2 or 3 commas this would make my structure not stable due to the fact that i have no control over the number of rows that can be produce,

Thanks and best regards,

Vincent Quizon
So your values are separated by commas but some values may also contain commas that break your csv parsing, is that the problem? Are the string values inside quotation marks? If they are, a good parser can ignore the commas inside the quotation marks.

If you are working with .NET I recommend you the FileHelpers library (free):
http://www.filehelpers.net/

Carlos Henriques wrote:
So your values are separated by commas but some values may also contain commas that break your csv parsing, is that the problem? Are the string values inside quotation marks? If they are, a good parser can ignore the commas inside the quotation marks.

If you are working with .NET I recommend you the FileHelpers library (free):
http://www.filehelpers.net/
 
 Hi Carlos ,

Yes exactly! I've yet to find a good parser for this, although i'm trying to use regex_replace to replace my commas with space i can't seem to get the right reg ex.


There is no regex for it or other solution on the parsing side. The source needs to properly quote strings that contain a comma.

J.Ja
Justin James wrote:
There is no regex for it or other solution on the parsing side. The source needs to properly quote strings that contain a comma.

J.Ja
 I think i found a solution for this. i split the csv using newline to separate rows and then for each row i used an sql function to remove commas inside the quotes which leaves the commas outside, but then the next problem is an issue of speed caused by individually checking the lines and assigning them to their respective columns to be used as a record and uploaded as a recordlist. 
 
If the CSV has newlines between records (which it should) and quotes aorund strings that have commas in them (which it should), why won't any of the standard CSV parsers work? That's the way CSV is supposed to look.

J.Ja
Hi john,

Can you attach your CSV file?
Suraj Borade wrote:
Hi john,

Can you attach your CSV file?
 Hi Suraj,

The thing is the information included in the csv file is highly confidential so i can't post the actual data. but i solved the problem already. :)

Just like what Justin said the csv has new lines between records and the string containing commas inside the are inside quotes. the problem i encountered is that i tried to parse the data in Outsystems. My solution required me to use a sql function to remove commas inside the quotes and then proceed with the action.

Thank you so much for your reply! :)