Skip to content

Latest commit

 

History

History
 
 

browse_download_to_csv

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Adding a "Download to CSV" button in a Browse Screen

  1. Create a Procedure: Tab Builders -> Procedure -> Add

  2. Code: BrowseDownloadToCSV

  3. Give it a description. (E.g. Downloads data in a Browse Screen as a csv)

  4. Paste the PHP code from the file BrowseDownloadToCSV.php to the PHP field.

  1. Save

  2. Add this JavaScript Code to your form’s Custom Code field:

How to add Custom Code

function base64encode(str) {
	let encode = encodeURIComponent(str).replace(/%([a-f0-9]{2})/gi, (m, $1) => String.fromCharCode(parseInt($1, 16)))
	return btoa(encode)
}

function browseDownloadToCSV() {
	nuSetProperty('browse_sql', base64encode(JSON.stringify(nuCurrentProperties().browse_sql)));
	nuRunPHP('BrowseDownloadToCSV');
}


if(nuFormType() == 'browse'){
    nuAddActionButton('browseDownloadToCSV', 'Download to CSV', 'browseDownloadToCSV();');
}
  1. Save

Now you see a new button "Download to CSV" in your Browse Screen!