Forums

CSV/XLS Export in СF6

weprde 01 Nov, 2018
Chronoforms v6 is an awesome tool!

I am trying to export data that are saved from a form into a table to a csv/xls file, but the exported file is empty.

Following the advice written here (https://www.chronoengine.com/forums/posts/t104177/), in the Load area, I have used a ReadData action with model name Data1. I am returning all matching records without any criteria. I also print all matching records (in a Display action) with custom html code and a Loop action.

In the form there is a checkboxes field named "answers", so I used "answers/json" in the Special Fields of the ReadData action.

I have a submit button in order the file to start downloading thus, in the Submit area, I have placed the CSV action with:

Data provider: {var:read_data1}
Action: Download
Delimeter: ,
Filename: csv1.csv

and Titles:

aid.ID
firstname:FirstName
lastname:LastName
answers: Answers

The only export I get is a csv file with Titles but no data (table records). Could you please send me any advice.

Thank you.

Best regards,
healyhatman 01 Nov, 2018
Set data provider to
{var:read_data1.[n].model}
weprde 08 Nov, 2018
Thank you very much healyhatman!
Along with your advice I moved both read_data and CSV actions to be together either in the Load or the Submit section and now my csv/xls contains data.

So, the csv file is ok but the page seems to be in processing (processing circle in the middle of the screen does not go away) although the file is completely created and downloaded.

I 've tried a message or a stopper action right after csv action but the page is in process without ending.

Any advice here?

Thank you
GreyHead 09 Nov, 2018
Hi weprde,

When you use a file download CF loses control of the actions at that time. You can keep control by saving the file to the server, then showing a 'Thank you' page with a download link to the file.

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