/
How to Add a Download Button to Dashboard

How to Add a Download Button to Dashboard

You can add a button to the Dashboard that will download the dashboard data into a file. The button and what it does when clicked is defined by a calculation logic.

To render the button in the Dashboard portlet, use the DashboardController method addDownloadButton in the calculation logic. You can add URL parameters determining the output format and the name of the file.

Examples:

This backend call runs the specified dashboard logic, exports the data into the XLSX format and downloads the file with the specified name:

controller.addDownloadButton('Download Excel','/formulamanager.executeformula/dashboard_export_logic?output=xls&fileName=MyDownloadedFile')

The following backend call runs the specified dashboard logic, exports the data into the PDF format using the specified template and downloads the file with the specified name. It also supplies values for parameters defined in the logic.

controller.addDownloadButton('Download PDF','/formulamanager.executeformula/dashboard_export_logic?templateName=MyTemplate&output=pdf&fileName=MyDownloadedFile', '{"Param1":"Test01", "Param2":"Test02"}')

Often, you will need to use a variable in the fileName URL parameter to make the file name generation dynamic:

def FileName = 'MyDownloadedFile' //or more typically a dynamically generated file name controller.addDownloadButton('Download Excel','/formulamanager.executeformula/JJ_dashboard_export_logic?output=xls&fileName=' + FileName)

Note:

  • If no file name URL parameter is set, the name consists of the (unique) name of the logic and the time stamp.

  • The file name cannot contain the following characters and they will be replaced by an underscore when the file is generated: \ / | : " * ? < > . All special characters will be replaced with regular characters (e.g., ö, á → o, a).

 

Related content

When to Use Asynchronous Download of Excel Files
When to Use Asynchronous Download of Excel Files
Read with this
How to Create Wizard Dashboard
How to Create Wizard Dashboard
More like this
How to Generate Excel Reports from Calculation Logic
How to Generate Excel Reports from Calculation Logic
Read with this
How to Create Wizard Dashboard
How to Create Wizard Dashboard
More like this
How to Add Approver to Workflow Email Template
How to Add Approver to Workflow Email Template
Read with this

Found an issue in documentation? Write to us.