Forums

How to export form data

giulia72 16 Mar, 2016
Hi
Is it possible to export the form data in a file ?

Thanks
Giulia
GreyHead 16 Mar, 2016
Hi Giulia,

Yes, there is a CSV Export action in the Data Management group. Does that do what you want? IMHO it's not much practical use for single records.

Bob
giulia72 17 Mar, 2016
Hi Bob
yes it could be what I'm looking for
I need to save the received module forms data and export to a file.
But how can I configure this action?
Do I have to add below on submit event?

Does it append all the records in a unique csv file?

Thank you again for your help
GreyHead 17 Mar, 2016
Hi giulia72,

You haven't said exactly what you need to do so it's a bit hard to answer. The CSV Action lets you export all of the records from a table - though you can select the columns to include/exclude. (I also have a custom CSV EXport [GH] action that lets you select the records to export.) Add the action to a test form to see the settings.

Bob
giulia72 17 Mar, 2016
Hi Bob
what I want to do is to export all the the records that refers to a specific module form, so I think CSV Action should be ok.

I don't know where I have to put this action
GreyHead 17 Mar, 2016
Hi Giulia,

I would create a new form with Admin only access - use the Authenticator action in the On Load event for that plus an HTML (render form) action. Add just a Submit button to the designer, then the CSV Export in the On Submit event.

Bob
giulia72 18 Mar, 2016
Hi Bob
Thank you for your help.
I will try as I upload the website

Cheers
Giulia
giulia72 15 Sep, 2016
Hi Bob
I'm recalling this post as I'm defining the last configuration.
Let me summerize:

I have created a Request Download Form, where users request to download a file and they fill the form with some information.
We want to export all data of this form in a CSV file.
It would be great to make this action automatically (e.g. each month this file should be sent to an email address).
Otherwise would it be possible to create a form (accessible only to some users group) that make this export action by a form?

Reading your last answer it seems it is possible to do it.
Do you have an example? or step -by-step procedure?

Sorry i'm boring you again.

Thanks
Giulia
GreyHead 15 Sep, 2016
Hi Giulia,

Both of these are possible,

Start with the simpler one of a manual form.

Create a new form; in the Designer tab add just a Submit button; in the Setup Tab add an Authenticator action and an HTML (Render form) action in the On Load event; configure the Authenticator to allow Public and Admins (or SuperAdmins); add a ReDirect action into the pink On Fail event and point that to index.php

In the On Submit event add a CSV Export action and configure it to select the records you want. You could also use a DB Read before the CSV Export to give more control over the selected records. (You might want to add more inputs in the Designer tab if you want to allow different choices.)

Test

If you want to export once only then add an 'export' column to the table and after the CSV export action add a DB Read action to update the records to show 'done' or something like that. Then you can check for new records only in the DB Read action.

If you add an Email action you can attach the exported file to it.

If you want to automate this then remove the Authenticator and call the submit event directly from a cron job on your server that runs once a week/month, etc.

Bob
giulia72 15 Sep, 2016
ok I'm starting woth manual form action.
I'm configuring the CSV Export action, but I see only 2 tables chronoengine_forms and chronoengine_extensions that I suppose don't contain any data of my form.

Maybe I miss to configure some action in the form I want to get data. I suppose the data must be saved on a specific table.

What is my mistake?
GreyHead 15 Sep, 2016
Hi Giulia,

The Table selector should show you a list of all the tables in your Joomla! database. I cannot think of any reason why you would only see two of them :-(

Bob
giulia72 15 Sep, 2016
As you can see in the enclosed pdf , I have the list of all the tables ofmy database but no one of them seems to be referred to my "download_request_form"
For this reason I think to have missed some configuration in my "download_request_form"
GreyHead 15 Sep, 2016
Hi Giulia,

What did you call the table when you created it?

Bob
giulia72 16 Sep, 2016
Hi Bob
I never created any table, I have only created the module form Download_request.
For this reason I asked you maybe there is something missing.

Do I have to create the table manually?
How can I configure in Chronoform to register data of my Download_request form in a specific table?


Thank you
giulia72 16 Sep, 2016
Hi Bob
Thank you the video helps me to configure the table.

Now I have 2 problems (the first one is only a doubt):

1. I want to exclude some columns in the CSV export so I have configured the CSV export action as the enclosed pdf
2. I have followed video instructions with db save action and when I fill my form I'm redirect to an error- 1054 page:
Unknown column 'Array' in 'field list' SQL=INSERT INTO `#__cf_download_request` (`company_name`, `First_name`, `Family_name`, `Job_title`, `Address1`, `Address2`, `City`, `State`, `Postal_code`, `Country`, `Phone`, `Email`, `checkbox_group15`, `comments`, `user_id`, `uniq_id`, `created`) values ('ARC', 'Giulia', 'Magnesa', 'web', 'Lodi', '', 'Lodi', '', '12345', 'Italy', '1234', 'g.magnesa@arcinfo.com', Array, '', '0', 'd1c5231afcfcca437ae9257d986ee290aa427f6e', '2016-09-16 09:13:08');

and obviously nothing happens.

What is wrong?

Thank you again for your precious help

Giulia
giulia72 16 Sep, 2016
Maybe I have to add Handle array action but I'm don't know how to use it
giulia72 16 Sep, 2016
Hi Bob
sorry I have just solved it:
for the point 2: I followed the instructions in the FAQ: https://www.chronoengine.com/faqs/63-cfv4/cfv4-working-with-form-data/3222-how-can-i-get-useful-data-from-select-drop-downs-checkboxes-and-radio-buttons.html

for the point 1: My configuration is correct

I'm going to see how to automatize this action ;-)
giulia72 16 Sep, 2016
Hi Bob
I would to put the export form under login. How can I do it?
I thught Joomla login action was what I'm looking for but it seems not as it requires to be just logged in

Is there any action in CF I could use?
or I have to create a login page before

Let me know your suggestion

Thank you
GreyHead 16 Sep, 2016
Hi Giulia,

For the array problem please drag a Handle Arrays action into the OnSubmit event and move it up before the DB Save action. That will convert any CheckBox group results from an array into a comma separated list.

You can use the Authenticator action in the form ON Load event to limit access to logged in Users. Make that the first action in the Event, configure it to allow the Public and Registered Groups and add a Redirect action into the pink on Fail box and have that redirect to index.php

Bob
giulia72 16 Sep, 2016
Hi Bob
Maybe I have not been clear:
regarding the array I have just resolved ( I wrote it in a previous post). Regarding the other question, I have just configured it as you wrote and it works, but I want Login page appears before to access to the form.

Maybe I have to configure Redirect action to login page instead of index.php page.

Could you confirm?
GreyHead 17 Sep, 2016
Hi guilia72,

Maybe I have to configure Redirect action to login page instead of index.php page.

Yes, that should do what you need.

Bob
giulia72 19 Sep, 2016
Hi Bob
Finally I have configured the export form after user login.

I was trying to configure the Email action, but it is not clear if this action must be inster at the end of CSV export action.

Also, how can I indicate in the Email action which file to send? I've notice the name of file changes as the date is attached at the end of file name.

Hope you can help me
GreyHead 19 Sep, 2016
Hi giulia72,

Sorry, I should have spotted this earlier. You need my custom CSV EXport [GH] action to attach the export file to an email. The standard one only allows for immediate download.

My action replaces the standard one but has more options - on the File tab you can configure the file settings including Forn data name which you can then use in the Attachments box of an Email action after the CSV Export action.

Bob
giulia72 20 Sep, 2016
Hi Bob
sorry but if I click on the link you sent, the page error "File not found " appears
GreyHead 20 Sep, 2016
Hi giulia72,

Sorry, Fixed now I hope.

Bob
giulia72 20 Sep, 2016
I'm sorry, same error when I click on the link:

Not Found

The requested URL /"https://www.dropbox.com/s/02yyhzz7l5ocke7/ChronoForms v5 action csv_export_gh.zip was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
GreyHead 20 Sep, 2016
Hi giulia75,

Sorry, not my day - it gained some quotes "" - please try yet again.

Bob
giulia72 20 Sep, 2016
ok got it

How can I use/import this action?
GreyHead 21 Sep, 2016
Hi giulia72,

Please use the Install Action icon in the Forms Manager toolbar. You should then see a new Actions Group called [GH] Custom Actions with the action in it. Drag it into your form and when you Edit it there is a Help tab with some instructions.

Bob
giulia72 21 Sep, 2016
ok installed, but what I can see this action substitutes the CSV export action so do I have to delete it?
I suppose I have to insert this action in place of CSV export. could you confirm?

After I have to insert Email action and insert the name file I set in this custom action. could you confirm?


My goal is to send the email each week, you mentioned ChronJob, but in Chronjob I need to insert an url ...which url ? of my form?


Sorry if I ask you a lot of questions...I hope to conlude this job early
GreyHead 22 Sep, 2016
Hi giulia72,

You probably don't want both actions so you can delete the standard one. If you want to you can make a copy or backup your form first.

Yes, you have to add a 'data name' in the Form Data Name box in the CSV Export [GH] action and the Email action Attachments box (the Email action must be after the CSV Export [GH] action).

It's a 'cron' job - see your web-host docs for setting it up - the URL is the same as the form one but with the event name added e.g. http://my_domain.com/index.php?option=com_chronoforms5&chronoform=form_name&event=event_name

Bob
giulia72 22 Sep, 2016
Hi Bob
Thank you for your precoius help
I will try ;-)
giulia72 22 Sep, 2016
Sorry
I have inserted in CSV export [GH]
File name = product_download_request
Form Data Name = csv_export

What do I have to insert in the Attachment File of Email action?
csv_export or product_download_request ?
GreyHead 22 Sep, 2016
Hi guilia72,

csv_export

Bob
giulia72 23 Sep, 2016
Thank you! it works
Now I will try to configure the cronjob (next week)

Thank you again for your patience ;-)
giulia72 29 Sep, 2016
1 Likes
Hi Bob
Just to inform you it work also in CronJob :-)

Thank you for your help

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