The Tournament Director Forums
Main => Beta Testing => Topic started by: acdctabs on November 30, 2011, 05:41:56 AM
-
Hi,
when you "extract" rank / names at the end of the tournament without column name, it make some "" "" around first line of csv anyway.
If you could correct it, it will be great :)
-
This is intentional, and not a bug. Quotations around column values are acceptable in CSV files, and necessary at times. They allow, for example, a column value to have a comma in it (without the comma signaling the start of the next column). When the TD exports to CSV, all values in the first line are quoted to avoid a "feature" of Microsoft Excel where Excel thinks the file is a SYLK file: http://support.microsoft.com/kb/323626
-
It was not the case before.
Could you put a case I can check to desactivate it ?
-
Correct, it was not the case before. It was added to deal with the issue I mentioned in my previous post. But I must ask, why is this an issue for you? The CSV file that is exported is standard CSV. Quotations around column values are completely legal and even necessary in many cases.
-
Long story ... I'll try to make it short.
I use csv to export players after tournaments, csv format, to send it to a database.
The quotations are embarrassing because I need to edit the file to remove them before sending it to the database.
So if i could desactivate the quotes i'll be happy :)
-
Sounds like whatever is importing from CSV doesn't know how to import from CSV. As I said, quotations are perfectly valid. In fact they are at times necessary. For example, let's say you used the Name Format:
{LN}, {FN}
(which would be last name comma first name) and exported the "Name" column, you'll get things like:
"Cooper, Corey"
If you omit the quotes, anything attempting to read the CSV file would think that is two columns instead of just one column which it really is. What are you using to import into your database?
-
My own php code :)
And I only use "nicknames" "notes" & "rank".
-
PHP has built-in functions for reading CSV files, like str_getcsv() and fgetcsv(). Are those not properly parsing the CSV file or are you using your own code to parse the file?
-
That's the part of the code I'm using :
$fic = fopen($dossier . $fichier, "r");
$i = 0;
while (!feof($fic)) {
$ligne = fgets($fic);
$liste = explode(",",$ligne);
$i++;
if ($i < $NbLigne) {$pseud = substr($liste[1], 0, -2);} else {$pseud = $liste[1];}
where $dossier & $ficher are the path/name of file
so we can say it's my own code but i did'nt invent it, I copy it from a friend who did the same thing before (and can't tell you where he finds it or if he invents it)
-
$fic = fopen($dossier . $fichier, "r");
$i = 0;
while (!feof($fic)) {
$liste = fgetcsv($fic);
// $liste = explode(",",$ligne);
$i++;
if ($i < $NbLigne) {$pseud = substr($liste[1], 0, -2);} else {$pseud = $liste[1];}
-
fix the "" problem but create another one because of ANSI / UTF8.
Thanks anyway, i'll continue to remove "" manually ^^