Forums

csv export with double quote

frimi 23 May, 2016
Hello,
how can I put out double quote in exportfile? Every value must be wrapped by quotes - whatever the colums are empty or not. Values without white-spaces or without any odd charakters must be wrapped too.
I did try (in coustom code):
[list]add quotes in strings('"hello"' or '""'): it put out 4(!) double-quotes...
with escape-character("\"" and '\"'): I see the Charakter with 4 double quotes
in delimiter-setup of csv-export: the semicolon get the Harry-Potter-Syndrom (it appears...)
once is a workaround: If I put a whitespace on evrey value, then it gets the double quotes correctly. But this solution is - in Germany we say "eine Krücke" - impractical.
[/list]

Is there more options than I did found?

Thank
Michael
GreyHead 23 May, 2016
Hi frimi,

I have sent you a PM with a link to my custom CSV Export [GH] action - that will let you specify an enclosure character.

Bob
frimi 23 May, 2016
Hi Bob,
thank for the file - it sounded very promising. But it has no effect because it put out all columns from DB.

I'm using Data Path, the DBcoloumns are controlled by the custom code (i did write) and in this context it works well with the old csv-export (in additional, it must be read from 2 tables with relation).
How shall I proceed with the new? Did I forget, overlooking anything?
GreyHead 23 May, 2016
Hi frimi,

Please check the Help tab in the action - you can use it to export from data loaded into the $form->data array, and you can specify which columns to export if you need to.

Bob
frimi 23 May, 2016
I'm so sorry, but it doesn't work.

In the Help tab there are listed 2 options: Table and Data Path - but in Tab 'Data' there 3. I choose Data Path. The name is the same name like Model ID in "DB Read" and it used in custom code. And now, I see no "include" or "exclude" Columns in the Tab of Columns/Columns Detail (...any 'included' or 'excluded' entries will be ignored...) or in the other.

It behaves like as thougt he export direct from table.

only to exclude a question: the file ist installed in /administrator/components/com_chronoforms5/chronoforms/actions/csv_export_gh near csv_export and there 2 files config.php und csv_export_gh.php and got I validated files?
And/or
Does csv_export_gh and csv_export work together?

Now, I'm so helpless 😉
Michael
GreyHead 23 May, 2016
Hi Michael,

Sorry, it looks as though the exclude columns was in a different version :-( You just have Include here.

Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

Bob
frimi 24 May, 2016
Hello Bob,

thank for your reply.

first of all: I can't get debuginfos if the exportaction is called or be executed. If this Action is disabled, I see the Debuginfos with array-dumps from an empty forms except the submit-button. There is no arraydata of the form. Do you can do anything with it?

Ok, I read once more the man and I see following paragraph:


There is an exception in the CSV Export [GH] action which is now included as a part of the standard ChronoForms release and therefore maintained by Max. I have made some improvements in the version from my site which is now called the CSV Export v2 [GH] action.


it is confusingly to read this and the names of this file(s?) sounds different. Are there different files?

ok, here the dump:

Data Array

Array
(
    [chronoform] => swexport
    [event] => submit
    [button1] => Submit
    [swexport] => 
)

Array
(
)

Errors

Array
(
)

Debug Info

Array
(
)

Michael
GreyHead 24 May, 2016
Hi Micahel,

Which versions of ChronoForms and Joomla! are you using? As far as I recall the note you quotes was for CFv4 where Max added one of my actions into an official release of ChronoForms.

Your Debugger shows no data to be exported so I am now confused.

By all means PM me the site URL, the form name, and a SuperAdmin login and I'll take a quick look.

Bob
frimi 24 May, 2016
I use CF5 and Joomla 3.5.1
I sent you a PM
GreyHead 24 May, 2016
Hi frimi,

The form appears to be working correctly with either action, when you open it a CSV file is created immediately and downloaded. With the standard action the tab closes after the from is downloaded - but the file is OK.

I still don't know how you need this to work/

Bob
frimi 24 May, 2016
Hi Bob,

in my first posting I did explain what I want: a double quote for evrey field like e.g. "2016";"Hallo";"","" and so.
In additional, the first row with columntitles must be removed.

another point is the difference between both actions: The standard action, also without "gh" works good with my selected model, respectively custom code. But it seems that the gh-action doesn't work with my custom code and I don't know why. But I need my model with the custom code because I have tables with relations. You can see it if you compare either outputs.

Also, if there no solution what else can I do but to add white space on every value in the custom code and the user must remove the first row manually...

Michael
GreyHead 04 Jul, 2016
Hi Michael,

Ah, sorry I missed the double-quote *every* value requirement. Unfortunately that isn't standard CSV output so the CSV export actions don't behave that way. I think that you have to custom code this.

If I have time later I'll look at adding the 'forced enclosure' as an option to the [GH] action.

Bob .

Later: I found an method in this StackOverFlow answer that would do this. Basically, it reads all the data items, adds a string to the end of each '#@ @#' so that there is a space in the item, creates the CSV file then re-processes it to remove all the added strings. I looked at adding this to the action, it's possible but fiddly as you have to handle the titles and two different download cases. As it's not a common request I've decided not to add it right now.
frimi 08 Jul, 2016
Hi Bob,

I have helped myself with a workaround: For every field I add a white-space. I know that is not the best practice, but it works.
This doppelqoute is a request for an application, it is called "Swiss-Chess" (chess tournament manager) and is required for the player import of registered players.
If I have more time, I will deal with this issue in more detail or I'll develope an own modul

Michael
This topic is locked and no more replies can be posted.