Report data sources
Write SQL queries that load extra data into your next-generation PDF reports.
What a report data source is
A data source is a named SQL query on your company's data. A PDF template calls it by name and shows the rows it returns, for example the number of alarms per alarm type for a site.
The Data Sources list is on the Reports tab when next-generation reports are on. It shows each data source with its parameters. The built-in data sources come first; the built-in templates use them, and you can use them too, but you can't open, change or delete them. Your company's own data sources follow.
To add your own data sources, your company needs evalink analytics, and you need SQL knowledge.
Add a data source
To add a data source, go to Company › Settings › Reports.
- Under Data Sources, click Add Data Source.
- In Name, enter the name that templates use to call it. It must be unique.
- In SQL Statement, enter the query. Write each parameter as a name in double curly braces, for example
{{siteId}}. - Click Submit.
The data source appears in the list with the parameters found in the query. If your company doesn't have evalink analytics, Subscription required opens instead of the dialog.
Write parameters in the query
A parameter is a value the template passes in when the report runs, such as the site or the period. evalink talos inserts each value already in quotes, so don't add quotes yourself:
| The template passes | evalink talos inserts |
|---|---|
| One value | 'value' |
| Several values | ('value1', 'value2'), for an IN clause |
| An empty list | ('') |
| An empty text | '' |
Write WHERE site_id = {{siteId}} or WHERE site_id IN {{siteIds}}, not '{{siteId}}'.
Every parameter needs a value. A parameter without a value makes the report fail with "The value of parameter <name> is not defined"; evalink talos never inserts NULL. If a value can be empty, handle that in the SQL, for example by comparing with ''.
Edit a data source
To change a data source, go to Company › Settings › Reports.
- Under Data Sources, click the data source. Edit Data Source opens.
- Change the Name or the SQL Statement.
- Click Submit.
If you rename it, change the name in the templates that use it too.
Delete a data source
To delete a data source, go to Company › Settings › Reports.
- Click the delete button on the data source.
- In Confirmation, type
delete. - Click Confirm Delete.
evalink talos doesn't check whether a template uses the data source. Templates that still call it get no data from it.
Use a data source in a template
To show the rows in a report, call the data source by name in the template and pass its parameters. See Add data from a data source. Check the result in the live preview: a failing data source is listed under it.