Download files in a dashboard¶
You can add links/buttons in your dashboards to download files that your previously uploaded in Serenytics. For example, you can use this feature to share pdf files, ppt reports... Any file type is valid.
A link can point to a static filename or the filename can be build dynamically from the logged user's metadata or from dashboards' variables. This is useful for example when the file is different for each logged user.
File loading¶
Loading files is done in the Admin / Static files section.
You can load files on by one or drag and drop several files at once.
Add a button to download a file in a dashboard¶
Add a Button
widget and select the action Download a static file
.
Then, you can choose the mode to set the filename of the filename to download between : static mode or dynamic mode.
Static filename mode¶
With this option, you just have to pick the file to be downloaded in the list of files.
Dynamic filename mode¶
With this option, you must enter the pattern of the filename to download. It can include metadata of the logged user or dashboard variables.
Here is a typical example : {{$$login.business_unit$$}}_{{varYear}}_sales.xlsx
If the user has the metadata field business_unit
with value EMEA
and the dashboard variable named varYear
has
the value 2023, then the linked file will be EMEA_2023_sales.xlsx
. Of course, this file must have been uploaded first.
With lowcode¶
If you need to customize the link/button to download a file, you can use the functions
link_to_static_file
and link_to_static_file_by_name
.
You can create a custom widget (without any datasource) and use this snippet:
<a href={{link_to_static_file_by_name($$login.business_unit$$ + "_" + varYear + "_sales.xlsx")}}>
<div><span class="fa fa-download">Click here to download your XLSX file!</div>
</a>