Buy Now
Sign in

Export to CSV guide

ltempest , May 01 2019, 09:03
L
ltempest 68
May 01 2019, 09:03 #386448
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
admin 27
May 01 2019, 09:07 #386449
Did you check the CSV export demo form ?
Best regards
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
L
ltempest 68
May 01 2019, 09:49 #386452
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 7
May 01 2019, 13:21 #386458
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?
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
L
ltempest 68
May 01 2019, 13:39 #386459
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.
Attachments
Screenshot_2019-05-01_14.29.53.png
Screenshot_2019-05-01_14.29.53.png
(60.41 KiB)
151 Downloads/Views
Screenshot_2019-05-01_14.29.37.png
Screenshot_2019-05-01_14.29.37.png
(84.83 KiB)
146 Downloads/Views
Screenshot_2019-05-01_14.29.11.png
Screenshot_2019-05-01_14.29.11.png
(90.85 KiB)
147 Downloads/Views
Screenshot_2019-05-01_14.29.11.png
Screenshot_2019-05-01_14.29.11.png
(90.85 KiB)
149 Downloads/Views
Screenshot_2019-05-01_14.29.37.png
Screenshot_2019-05-01_14.29.37.png
(84.83 KiB)
151 Downloads/Views
Screenshot_2019-05-01_14.29.53.png
Screenshot_2019-05-01_14.29.53.png
(60.41 KiB)
145 Downloads/Views
admin 27
May 01 2019, 14:56 #386460
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
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
L
ltempest 68
May 03 2019, 13:40 #386484
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
admin 27
May 03 2019, 18:57 #386491
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
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
L
ltempest 68
May 07 2019, 10:47 #386611
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 7
May 07 2019, 11:26 #386613
Known issue with 6.1.1, update coming
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
L
ltempest 68
May 07 2019, 12:01 #386614
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
admin 27
May 07 2019, 20:17 #386626
It's released now, please update and let us know!
Best regards
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
L
ltempest 68
May 08 2019, 16:50 #386654
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?
L
ltempest 68
May 09 2019, 11:01 #386670
Hi Max,
I have created a login for you and hopefully attached the details to this post.
Thanks
Lee
The content here is visible only for authorized users.
The content here is visible only for authorized users.
admin 27
May 12 2019, 15:29 #386811
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
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!