How to build and design your template for a PDF report – Tutorial

In this example, we need a PDF report that shows:

  • Policy Number
  • Quoted Annual Premium
  • Quote Create Date

Step 1: Map required data sources

For this report, we need to use the Quotes data sets as the base. This provides the amount of premium that was quoted but didn’t become a bound policy. The policy status of the revision for a quote is one of the following:

  • Unsubmitted
  • Submitted
  • Quote
  • Rejected

Map your data by identifying your report columns and matching them with the relevant data set and corresponding data point.

Report ColumnData SetData point
Quote NumberPoliciesPolicy Number
Quote StatusQuotesQuote Status
Quote DateQuotesCreate Date
Quoted PremiumQuotesQuoted Written Premium

Step 2: Identify required filters

This is a simple report in terms of logic and transformations; the main purpose is to depict the integration with Jinja templates.

Step 3: Create a report

  1. On the Define your Report screen, select PDF under Choose a Report Type.
  2. Choose the following data points on the Choose your Data screen.

Rename columns by selecting the existing data point and typing the new one. Select the information icon to see the original data point label.

  1. On the Design the Template screen, edit the template with Jinja and HTML. The sample code for our .pdf report is shown below.

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>{{ report_model.name }}</title>
    </head>
    <body>
    <h1>{{ report_model.name }}</h1>
    <h2>Quotes {{ end_date.strftime('%m/%d/%Y') }}</h2>
    <table style="width:100%">
        <tr>
          <th>Quote Number</th>
          <th>Quote Status</th>
          <th>Quoted Date</th>
          <th>Quoted Premium</th>
        </tr>
        {% for _, row in data.iterrows() %}
        <tr>
            <td>{{ row['Quote Number'] }}</td>
            <td>{{ row['Quote Status'] }}</td>
            <td>{{ row['Quote Date'] }}</td>
            <td>${{ row['Quoted Premium'] }}</td>
        </tr>
        {% endfor %}
    </table>
	Date Updated: {{ run_date.strftime('%m/%d/%Y') }}
    </body>
</html>

Step 4: Final result

You can access the final report via Attachments in the Reports menu. You will also receive an email with the PDF.