Export current data viewto csv and pdf

saveg 30 Dec, 2019
Can someone pls share a clear and step by step info on how to export my current list view of records that I see on the screen to csv? and also pdf?
I just need to add a button at the end of page where if clicked it would export to csv. also I need pdf.
healyhatman 30 Dec, 2019
You have to read the data again then export.
saveg 30 Dec, 2019
thanks
Any how to to follow up and see how can this be achieved?
saveg 03 Jan, 2020
anyone there???
Im using the readall function then view table then added export csv but the problem I only get the download csv and its empty.
shall I create another function to read or what exactly??
healyhatman 03 Jan, 2020
What have you got in your csv export?
saveg 03 Jan, 2020
empty file
healyhatman 03 Jan, 2020
No, what have you got in the settings of your CSV export action?
saveg 03 Jan, 2020
see this pls
Export current data viewto csv and pdf image 1
healyhatman 03 Jan, 2020
Data provider is completely wrong, that's just a string. Try
{var:read_data_action_name.[n].model_name}
For example if your DB read is called "myRead" and your model is "entry" then that would be {var:myRead.[n].entry}
saveg 05 Jan, 2020
yes now its working fine
just wondering how can I add it as a button to export the current view only??
healyhatman 05 Jan, 2020
Use a toolbar button. List view name will be the name of the form element the filter options are in, event will be the event the CSV export is in.
saveg 06 Jan, 2020
ok thanks for clarification.
I went on and did the following
the action csv has only the {fn:csv_export} which was working fine but when I press the button to export
the csv file is now again empty.
Export current data viewto csv and pdf image 2
healyhatman 06 Jan, 2020
You need to read the data again, which is why you're submitting the filter form.
saveg 07 Jan, 2020
do you mean create another function / action to read data?? or just insert the read db function/action before the export in the event of csv export?
saveg 18 Jan, 2020
dear sir
the csv is exportign fine but the main problem is that all fields are exported despite the fact that the current view is few columns only. how can I reflect the csv to have my current view only.
in my csv event i have two lines
fn:readdb
fn:exportcsv
what im thinking is that is there a way to make a function that returns the current view?
healyhatman 18 Jan, 2020
No there's not.

Just restrict the read data action to only the fields you need.
This topic is locked and no more replies can be posted.