Quote from nichjoht on December 6, 2019, 7:40 amWhen issuing the following commands...
FileSaveBox "Save Categories" "Any File|*.csv" "[CurrentDir]" "[CatCSVFile]"
dbpExportToCSV "Expenses" "Categories" "[CatCSVFile]" "Range=All;Delimiter=,;IncludeHidden=No;IncludeFieldNames=Yes;UseColumnTitles=No;Append=No;ForceQuotes=No"
the CSV file is created in the following format...
Category,cClass
,Car,Normal
,"Car, gas",Normal
,Cash,Normal
,Clothing,Normal
,Entertainment,NormalThe field names are correct but there is a comma at the beginning of each record that should not be there.
Please assist and let me know what I'm doing wrong.
Regards,
John.
When issuing the following commands...
FileSaveBox "Save Categories" "Any File|*.csv" "[CurrentDir]" "[CatCSVFile]"
dbpExportToCSV "Expenses" "Categories" "[CatCSVFile]" "Range=All;Delimiter=,;IncludeHidden=No;IncludeFieldNames=Yes;UseColumnTitles=No;Append=No;ForceQuotes=No"
the CSV file is created in the following format...
Category,cClass
,Car,Normal
,"Car, gas",Normal
,Cash,Normal
,Clothing,Normal
,Entertainment,Normal
The field names are correct but there is a comma at the beginning of each record that should not be there.
Please assist and let me know what I'm doing wrong.
Regards,
John.
Quote from Gaev on December 6, 2019, 4:04 pm@nichjoht
Unless your Categories Table has a field where the name is empty/null, and row values for it are also empty, your experience seems odd.
a) Does this Table contain any other fields ? ... perhaps you can share the command used to create this Table
b) Before invoking the FileSaveBox and dbpExportToCSV commands, do you manipulate the columns (hide, change order etc.) in any way ?
Unless your Categories Table has a field where the name is empty/null, and row values for it are also empty, your experience seems odd.
a) Does this Table contain any other fields ? ... perhaps you can share the command used to create this Table
b) Before invoking the FileSaveBox and dbpExportToCSV commands, do you manipulate the columns (hide, change order etc.) in any way ?
Quote from Gaev on December 6, 2019, 4:07 pm@nichjoht
Sorry, I had to do it in parts because Forum software thought some of my content was dangerous.
It could be a defect (bug) in the plugin that was not detected by others ... if so, a workaround would be to ...
- use FileLen and Loop/EndLoop to do a FileRead of each line in the csv file
- use SubString and If/EndIf to check if the first character is a comma
- and if so, use StrReplace to replace it with a null before writing it back... I suggest using a subroutine for this ... so you can just comment out the GoSub when the issue is resolved.
Sorry, I had to do it in parts because Forum software thought some of my content was dangerous.
It could be a defect (bug) in the plugin that was not detected by others ... if so, a workaround would be to ...
- use FileLen and Loop/EndLoop to do a FileRead of each line in the csv file
- use SubString and If/EndIf to check if the first character is a comma
- and if so, use StrReplace to replace it with a null before writing it back
... I suggest using a subroutine for this ... so you can just comment out the GoSub when the issue is resolved.
Quote from nichjoht on December 6, 2019, 8:17 pmGaev,
thanks for the workaround. Are VisualNeo and the DB plugin still being developed and is there any hope for a fix soon?
To answer your questions in the e-mail:
a) Does this Table contain any other fields? ... perhaps you can share the command used to create this Table
The table only contains these two fields. The DB & tables were created with MS Access.
b) Before invoking the FileSaveBox and dbpExportToCSV commands, do you manipulate the columns (hide, change order etc.) in any way?
Nothing has been done with the columns, I just typed the data in by hand. Wrote a sub to save the data to a CSV file to have
a way to restore a basic data set in case I somehow mess the data up while developing the app.
Gaev,
thanks for the workaround. Are VisualNeo and the DB plugin still being developed and is there any hope for a fix soon?
To answer your questions in the e-mail:
a) Does this Table contain any other fields? ... perhaps you can share the command used to create this Table
The table only contains these two fields. The DB & tables were created with MS Access.
b) Before invoking the FileSaveBox and dbpExportToCSV commands, do you manipulate the columns (hide, change order etc.) in any way?
Nothing has been done with the columns, I just typed the data in by hand. Wrote a sub to save the data to a CSV file to have
a way to restore a basic data set in case I somehow mess the data up while developing the app.
Quote from Gaev on December 6, 2019, 11:33 pm@nichjoht
The table only contains these two fields. The DB & tables were created with MS Access.
It could be due to some incompatibilities between your version of MS Access and the version used by the plugin.
Just to be sure, you might use these neoDBPro commands to verify that there are just two fields ...
dbpGetFieldNames "database id" "table" "delimiter" "variable"
dbpGetFieldDefs "database id" "table" "delimiter" "variable"Also, you might create a new Database and Table using the commands available within the plugin ...
dbpCreateAccessDatabase "file name" "options"
dbpOpenAccessDatabase "database id" "file name" "options"
dbpCreateTable "database id" "table" "field defs"... then add a few records using ...
dbpAddRecord "database id" "table"
or
dbpShowGrid "database id" "table" "rectangle"
... and then do your dpExportToCSV to see if there is any difference ... if you still get leading commas then it would classify as a bug/defect.
Post all your results here.
The table only contains these two fields. The DB & tables were created with MS Access.
It could be due to some incompatibilities between your version of MS Access and the version used by the plugin.
Just to be sure, you might use these neoDBPro commands to verify that there are just two fields ...
dbpGetFieldNames "database id" "table" "delimiter" "variable"
dbpGetFieldDefs "database id" "table" "delimiter" "variable"
Also, you might create a new Database and Table using the commands available within the plugin ...
dbpCreateAccessDatabase "file name" "options"
dbpOpenAccessDatabase "database id" "file name" "options"
dbpCreateTable "database id" "table" "field defs"
... then add a few records using ...
dbpAddRecord "database id" "table"
or
dbpShowGrid "database id" "table" "rectangle"
... and then do your dpExportToCSV to see if there is any difference ... if you still get leading commas then it would classify as a bug/defect.
Post all your results here.