Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Export form to CSV file Topic is solved

Questions related to using nuBuilder Forte.
Post Reply
nadir
Posts: 44
Joined: Mon Apr 21, 2025 7:03 am
Has thanked: 5 times
Been thanked: 4 times

Export form to CSV file

Unread post by nadir »

Hello,

I want to add a new action button besides the print button. It should allow downloading the contents of the form as a CSV file. I read the following post for exporting form as CSV file:

viewtopic.php?t=10071

I used following code to display the action button:

Code: Select all

if(nuFormType() == 'browse'){
    nuAddActionButton('DownloadCSV', 
                      '', 
                      'nuSetProperty("browse_sql",nuCurrentProperties().browse_sql); nuRunPHP("DownloadCSV")',      
                      'Download to Excel',
                      'fa-fw fa fa-file-excel fa-lg'); 
}
How do I get the form data exported to CSV file and then start the download ?

Thanks,
Nadir
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: Export form to CSV file

Unread post by kev1n »

Hi,

Do you want to download just the current record as CSV or a Browse Form?

In any case, you will need to create a Procedure that selects the fields and downloads the data.

:arrow: See Code-Library
nadir
Posts: 44
Joined: Mon Apr 21, 2025 7:03 am
Has thanked: 5 times
Been thanked: 4 times

Re: Export form to CSV file

Unread post by nadir »

Hi,

I want to download the browse form. Can you provide sample code for exporting the browse form to csv and starting the download
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: Export form to CSV file

Unread post by kev1n »

Sample code can be found in the Code Library, see link above
nadir
Posts: 44
Joined: Mon Apr 21, 2025 7:03 am
Has thanked: 5 times
Been thanked: 4 times

Re: Export form to CSV file

Unread post by nadir »

I followed the instructions in the Code Library document. The CSV download button works fine. Thanks.
Post Reply