Embedded comma in CSV header

Support for DataSlave

Moderators: Tom, ian

Embedded comma in CSV header

Postby phrenetic » Mon Oct 17, 2011 8:36 am

It looks like embedded commas are incorrectly handled when importing CSV files.

If I have a CSV file that contains column headers in the first line, for example:

"Date","Time","Sensor","Status (1=active, 0=inactive)"
"17/10/2011","06:00","A001","1"

then DataSlave incorrectly parses the header into 5 columns:

Date
Time
Sensor
Status (1=active
0=inactive)

Alistair
phrenetic
 
Posts: 7
Joined: Wed Oct 12, 2011 9:56 pm

Re: Embedded comma in CSV header

Postby ian » Mon Oct 17, 2011 4:53 pm

The problem is that the column title is illegal.

I attach a map that illustrates how to manage the file changing the column title to "Status".

I have also illustrated in the map that a comma is handled in the data.

I hope this solution allows you to proceed. Please do send us (support@...) some sample data if you would like us to investigate further.
Attachments
CSV_Embedded_Commas.zip
(3.69 KiB) Downloaded 438 times
ian
 
Posts: 364
Joined: Sat Dec 18, 2004 8:13 am
Location: UK

Re: Embedded comma in CSV header

Postby phrenetic » Mon Oct 17, 2011 5:44 pm

Ian

Thanks.

I was aware that the data was handled correctly (I hand-edited the column names in the input file), only that the header was incorrectly parsed. I'll check out the mapping for handling the automatic renaming of the field.

Alistair
phrenetic
 
Posts: 7
Joined: Wed Oct 12, 2011 9:56 pm

Re: Embedded comma in CSV header

Postby phrenetic » Mon Oct 17, 2011 5:58 pm

Ian

Just wanted to check one more thing. The workaround that you have given me in the map - will that work in batch mode? i.e. it won't skip the first record of every batch will it?

Alistair
phrenetic
 
Posts: 7
Joined: Wed Oct 12, 2011 9:56 pm


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron