Forums

Export to CSV guide

ltempest 01 May, 2019
Hello,
I'm struggling to understand what must be a simple process but cannot find a step by step guide as to how to achieve exporting a form submission as a CSV file.

Please help!

I have a test form setup, in the actions I have a save to db action, then an export CSV which is set to save the CSV to the default location {path:front}/csv/csv2.csv

In the action I have entered {data:} for the Data provider. and the action is set to Store.

However, when I complete the form and submit, I get an error:

  • Error saving the csv file.
What have I done wrong? I only want the single form submission to be saved as a CSV and not historical ones that may have been added previously. Does the CSV export action only save the most recent submission? I need it this way as the form is an 'order form' of sorts and each submission needs to be handled separately.

Is there any possibility of adding an FAQ page detailing how to setup a basic CSV export?

Thanks
Max_admin 01 May, 2019
Did you check the CSV export demo form ?

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ltempest 01 May, 2019
Max,
Thanks for the reply, but I'm more confused than ever now!

I have the DEMO CSV form, but cannot see how this relates to my form. This exports article data I believe?

I want to be able to save every form submission as a separate CSV file into the same folder, as these are processed as individual orders.

So what actions do I need in the on submit? First a database save, then a database load and then the CSV export? Is that correct? How do I configure the load and save actions?

Thanks for the help.

Lee
healyhatman 01 May, 2019
Why would you want a CSV for every single order, that's.... Just not what it's for?

What does your debug say? What do your CSV settings look like?
ltempest 01 May, 2019
Hi,
The CSV file that is exported needs to be an individual submission as this is then handled by the processing department automatically. When a new submission is created and added to the CSV export folder it is transferred to another server controlled by a separate company, They then read this CSV file into their order processing system and completes the order. This is all done automatically and almost immediately so that orders are fulfilled and despatched as soon as they are received without the need for any 'human' processing.

I hope that makes sense!

I've attached some screenshots from my testing form setup.

Thanks for the help.

​[file=12159]Screenshot_2019-05-01_14.29.11.png[/file]
​[file=12160]Screenshot_2019-05-01_14.29.37.png[/file]
​[file=12161]Screenshot_2019-05-01_14.29.53.png[/file]
Max_admin 01 May, 2019
The CSV expects the data source in this format:
[0 => ['name1' => 'value1', 'name2' => 'value2']]
The form data array has the inner array only, and so you may modify the array format first using a PHP action:
return [$this->data];
And then use {var:php_name} as the data provider for CSV, you may also set only the specific fields you want.

But the "Error saving CSV file" may be a problem with the folder does not exist or some permissions.

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ltempest 03 May, 2019
Max,
Forgive me I do not understand your last post!

Would you be kind enough to lay out exactly what I need in each field or action? Are you saying I need to include every field?

This is the "order form" in all its glory, its very large!

https://staging.hunterpanels.com/sample-literature

Sorry I'm just totally confused and need hand holding! apologies! Would admin access be helpful?

Lee
Max_admin 03 May, 2019
Hi Lee,

In your submit event:
1- Add php action, call it csv_data, use this code:
return [$this->data];
2- Add a CSV export action, set the data provider to {var:csv_data}

Does that help ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ltempest 07 May, 2019
Max,
Thanks for the explanation, yes it does help.
I tried to follow your instructions, but it seems every time I add a Logic >PHP action and add the code you mention, I save the form but the PHP action is not saved and disappears?

I'm using version 6.1.1 of Chronoforms and the screenshot shows my setup before I save, once I save and reopen the PHP action is no longer displayed. What have I done wrong?

Thanks

Lee

healyhatman 07 May, 2019
Known issue with 6.1.1, update coming
ltempest 07 May, 2019
Healyhatman,
Thanks for the information, glad to know its a bug and nothing I'm doing wrong!

Do you have any idea of when an update is due to be released?

Thanks
Max_admin 07 May, 2019
It's released now, please update and let us know!

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ltempest 08 May, 2019
Max,
The update has fixed the issue of not saving the PHP action, but now when I complete the form form It appears to 'hang' with a spinning 'loading' icon and a blank csv gets downloaded.

Can I send you logins to check?
ltempest 09 May, 2019
Hi Max,
I have created a login for you and hopefully attached the details to this post.

Thanks

Lee

This is private content

This is private content

Max_admin 12 May, 2019
Hi Lee,

When a download starts the page will not open, that's normal behavior.

If you want to show the page THEN start the download then use a "Redirect" instead of the CSV, then move the CSV to a different form page, then set the redirect "Event/Page" to the new Page name and add a time delay, say 1 second.

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.