ElijahFowler / CSVtoTable

Automatically exported from code.google.com/p/jquerycsvtotable
1 stars 0 forks source link

Final column in CSV file is treated as text not number. #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

I have a CSV file that looks like this:

"Volume","Description","Size","Used"
"lbu_vc01_vfi01_vol00","vFiler root","10","0"
"lbu_vc01_vfi01_vol01","Infrastructure VMs","1410","66"
"lbu_vc01_vfi01_vol02","VMware cluster","20","0"
"lbu_vc02_vfi01_vol00","vFiler root","10","0"

The table that is produced by CSVTable looks like this:

<thead class=""><tr class=""><th class="">Volume</th><th 
class="">Description</th><th class="">Size</th><th 
class="">Used</th></tr></thead><tbody class=""><tr class=" odd"><td 
class="">lbu_vc01_vfi01_vol00</td><td class="">vFiler root</td><td 
class="">10</td><td class="">"0"
</td></tr><tr class=" even"><td class="">lbu_vc01_vfi01_vol01</td><td 
class="">Infrastructure VMs</td><td class="">1410</td><td class="">"66"
</td></tr><tr class=" odd"><td class="">lbu_vc01_vfi01_vol02</td><td 
class="">VMware cluster</td><td class="">20</td><td class="">"0"
</td></tr><tr class=" even"><td class="">lbu_vc02_vfi01_vol00</td><td 
class="">vFiler root</td><td class="">10</td><td class="">"0"

As you can see the numbers in the final column are surrounded by quotation 
marks, whereas those in the preceding column are not. It looks like it is 
treating the final column as text rather than numbers.

What version of the product are you using? On what operating system?
Firefox 16.0 on Windows 7

Thanks for any help you can offer.

Regards,

Mark

Original issue reported on code.google.com by m.j.new...@lboro.ac.uk on 18 Dec 2012 at 10:20

GoogleCodeExporter commented 9 years ago
Hello,

I've managed to fix this bug with the follow amendment to line 99 of the code:

< var lines = data.replace('\r','').split('\n');

> var lines = data.replace(/\r/g,'').split('\n');

Regards,

Mark

Original comment by m.j.new...@lboro.ac.uk on 2 Jan 2013 at 10:00