evalinkdocs

The template designer

Design a next-generation PDF template: its email texts, its sample data, its HTML, and the live preview that shows the result.

What the designer shows

The designer is the dialog that opens when you add, edit or view a PDF template (Create Report Template, Edit Report Template or View Report Template). It has two tabs on the left and the preview on the right:

  • Info: the name and description of the template, and the email that carries the report.
  • Template: the Context with sample values, the Object data they load, and the Template itself.

The buttons in the header duplicate the template, switch the preview between live and PDF, and show or hide the preview.

A template is one HTML document in Angular template syntax: {{ ... }} for values, *ngIf and *ngFor for conditions and lists. You need some HTML knowledge for bigger changes. For small ones, such as another heading or logo, change a copy of a built-in template.

Fill in the Info tab

Field What it does
Title The name in the template list and in the report menus. Required and unique.
Description Shown in the list and when someone picks the template for an automated report.
Type of template The report type. Set when you add the template; you can't change it.
Email Subject Template The subject of the email that sends the report.
Email Text Template The text of that email.

If you leave the email fields empty, evalink talos uses your company name and the file name.

Set the sample data in Context

The Context box holds the values the preview uses, as JSON, for example the site, the workflow and the report period. evalink talos fills it in for you with one of your sites, your latest workflow and the last 30 days.

  1. On the Template tab, change a value in Context, for example put the ID of another site in deviceId.

The Object data next to it shows the data that these values load: the site, the alarm, the workflow and so on. Expand it to find the names you can use in the template.

Where a template can be used

The names in Context are the parameters of the template, and they are saved with it. They decide where the template is offered:

  • With deviceId, the template is offered for sites; with deviceGroupId, for site groups.
  • With reportStart and reportEnd, the Run report dialog asks for a period.
  • With includeTestMessages, it offers Include Test Messages.

So keep the names the built-in template of the same type uses. A template that lacks deviceId doesn't appear in Export PDFs on a site.

Preview the report

To see the result while you work, keep the preview open. Use the buttons in the dialog header:

Button What it does
Two arrows (live) Shows the report as you type, about a second after you stop
PDF Has the server create the real PDF
Preview Shows or hides the preview

Use the live preview while you design and the PDF preview before you save. If the template is empty, the preview shows "Unable to show the preview".

Fix problems in the preview

In the live preview, problems are listed under the report with an error icon, for example a wrong expression or a data source that failed ("Data source <name>: <message>"). A failed data source shows as an empty table instead of stopping the preview, so check the list when rows are missing.

The list shows the problems of the latest preview only.

Add data from a data source

To show data that the context doesn't contain, load it from a report data source by its name, with its parameters:

<ng-container pdfDataSource="ZONE" [parameters]="{ deviceId: parameters.deviceId }" #zones="pdfDataSource">
  <div *ngFor="let zone of zones.data">...</div>
</ng-container>

Give every parameter of the data source a value, or the data source fails.

Let the assistant change the template

If you can use evalink agents, the assistant sits beside the designer. Ask it in plain words for a change to the report, its data or its email. Each change appears in the preview right away, with a note on the field it changed and a button to undo it. Click Submit to save. Hide or show the assistant with its button in the header.