I have not found updated tutorials to be able to create (in a php page containing a dynamic records table) a button to export a CSV or better still XLS file
If I understood correctly I have to create a Server Action containing
a Database Query action (filtered) of the table to export
an Export CSV File action. to create the file to export
a File Upload action to save the file in the "upload" folder
Then, you need to create a button on the page to download the file
I have tried various solutions, but it does not work for me.
Obviously I am the one who is wrong but I do not understand where
How many complications for a procedure that should be easy
I then read your suggestions calmly
But one thing that leaves me perplexed
I did a test.
I manually uploaded a file conto_agenzia.csv to the server's upload folder
I only tried to use the download, but it gives me an error in the connection
I already use the debugger
The problem is currently setting the correct path, because this is the error I find
I also created a "download" folder with all the writing permits, positioned in the main folder of the site
I am trying the correct connection
if the query should always return data, check your query setup
if there is a case that no data will be found, you should add a condition step and check if the query has data... If there are data, then export to CSV.
The fact is that the query had filters configurable on the table page.
Leaving the problem of the filters at the moment, if I remove them from action the step 2 regularly saves the CSV file in the "download" folder of the server
Thanks Teodor, always decisive, but thanks also to the friends who supported me
Now I finally managed to overcome the various mistakes and now the export of the query in a CSV file is ok
However, there remains a problem that I submit to Teodor
The procedure worked only by eliminating the references to the filters, which are decided on the page
My need, however, is to be able to change the list by acting on a Datepicker filter (this already works very well) but the exported file reports the total of records, because I deleted the filters from the query used by the export action.
I hope I have explained the problem well
How are you providing information for the date filter to CSV query? Please show us how the filters ($_GET) have been setup in the CSV query and the event that is triggering this export query.
This is the condition that works very well on the table.
Choosing a period, the list is modified
But does not produce the same result on the exported file
In practice it should work like this: