Create a report in a custom format
Reports can now be exported in custom format (CSV, JSON or XML).
General principle
Reports in custom format can be created in 3 steps:
- Create a report to define the data you want in the reports
- Create a template to define the format and the structure of the information you want to export in your report
- Create a notification in your report to use the template
With the Excel templates, the datapoints and the metadata (Sources, Sites, Alerts etc.) are exported in sheets. With the custom template the output file extension and structure can be defined in one file.
It's possible to export one or more files that contain data and/or metadata.
Example:
- One file containing only data points.
- One file containing only sources.
- One file containing data points and all relevant metadata (sites, sources,...).
One template can be used for several reports.
Create a report
To create a report go to the Reports page and click on Actions, then Create Report. The report creation pop-up opens. You can now fill all the fields as follows.
Tip
Learn more about reports creation
Create a template
Templates can be defined in the Account page in Data Hub 5.0 preview or via the API. Go on the Account page and click on the "Template" tab. This page will display the list of your report custom template. To create a new one, click on the Add template button and fill the requested field:
- Template name
- Template format
- Body
The body is using the Scriban library version v2.1.3.
An advanced helper is available below the body to help you with Scriban.
Tip
Learn more about using the advanced helper
Create a notification to use the template
Once your report and your template are created, you just need to create a new notification in your report to export your report in the template. You can send your reports with custom template through:
- Storage
- FTP
Just select format Custom and the template you want to use.
Note
For emails, we recommend that you send large files as link instead of attachment, so as not to be blocked by mailboxes.