Detailed Template Example


The following is a larger report template example that illustrates various features including:

Feature ExampleSyntax
Displaying variables{{ folder.name }}
Using filters{{ at.filesize | filesizeformat }}
Looping over lists of data{% for im in folder.images %}
Checking conditions{% if report_signed_by %}
Accessing static data{% for item in static_data['foo'] %}
Accessing the list of images in the folder{% for im in folder.images %}
Accessing the list of snapshots for a given image{% for snapshot in im.snapshots %}
Accessing snapshots in a container{% for snapshot in snapshots['container1'] %}
Displaying image thumbnails<img src="{{ im.get_thumbnail(bounds=[200,200]) }}" />
Displaying image regions<img src="{{ snapshot.get_region(bounds=[300,300]) }}" />
Displaying slide labels<img src="{{ im.get_label(bounds=[200,200]) }}" />
{% block title %}
{# Set the title of your PDF document in this block (text only) #}
PDF Report Title
{% endblock %}
{% block body %}
<div class="container">
{#
Add any text such as a report title or description of the report anywhere in the
report template using different HTML blocks such as paragraph tags <p>,
line breaks <br>, headings <h1> / <h2> / etc.
#}
<h1>Detailed Report</h1>
<p>
Use variables passed to the template like this: The name of the case is {{ case.name }}.
</p>
<h2>Folder Name</h2>
{# Displays the currently selected folder's name #}
{{ folder.name }}
<h2>Folder ID</h2>
{# Displays the currently selected folder's ID in PathcoreFlow #}
{{ folder.id }}
<h2>Folder Description</h2>
{# Displays the currently selected folder's description #}
{{ folder.description }}
<h2>Custom Fields</h2>
{# Displays all the custom fields associated with the folder #}
{{ folder.fields }}
<h2>Static Data</h2>
<ul>
{# Begins looping through the static data array called 'foo' #}
{% for item in static_data['foo'] %}
{# Outputs each item in the 'foo' array #}
<li>{{ item }}</li>
{% endfor %}
</ul>
{# Outputs string variables 'name' and 'date' from static_data #}
<p>
Name: {{ static_data['name'] }} <br>
Date: {{ static_data['date'] }}
</p>
<h2>Images</h2>
{# Begins looping through all the images in the currently selected folder #}
{% for im in folder.images %}
{# Outputs the properties of each image #}
{# Outputs the image name, ID, filesize #}
<h3> {{ im.name|e }} (ID: {{ im.id }}) ({{ im.filesize | filesizeformat }}) </h3>
{# Displays the actual image as a thumbnail #}
<img src="{{ im.get_thumbnail(bounds=[200,200]) }}" />
{# Displays a portion of the full size image #}
<img src="{{ im.get_region(area=[0, 0, 10000, 10000], bounds=[200,200]) }}" />
{# Displays the slide label of the image (if available) #}
<img src="{{ im.get_label(bounds=[200,200]) }}" />
<h4>Snapshots</h4>
{# Snapshots and snapshot metadata for each image can also be displayed #}
{% for snapshot in im.snapshots %}
{# Displays the title, id and description of each snapshot #}
<div>
<p>Title: {{ snapshot.title }}</p>
<p>ID: {{ snapshot.id }}</p>
<p>Description: {{ snapshot.description }}</p>
{# Displays the snapshot #}
<img src="{{ snapshot.get_region(bounds=[150,150]) }}" />
</div>
{% else %}
<p>No snapshots!</p>
{% endfor %}
{% endfor %}
<h2>Attachments</h2>
<ul>
{# Begins looping through all the attachments in the currently selected folder #}
{% for at in folder.attachments %}
<li>
{# Outputs the attachment name and filesize #}
{{ at.name }} ({{ at.filesize | filesizeformat }})
{# Outputs the attachment URL #}
<a href=" {{ at.file_url }}"> {{ at.file_url }} </a>
</li>
{% endfor %}
</ul>
<h2>Snapshots</h2>
{# Snapshots can also be displayed without accessing their associated image #}
{# Begins looping through all the snapshots in the snapshot container 'container1' #}
{% for snapshot in snapshots['container1'] %}
{# Displays the title, id and description of each snapshot #}
<div>
<p>Title: {{ snapshot.title }}</p>
<p>ID: {{ snapshot.id }}</p>
<p>Description: {{ snapshot.description }}</p>
{# Displays the snapshot #}
<img src="{{ snapshot.get_region(bounds=[300,300]) }}" />
</div>
{% endfor %}
<p>If the report is signed, the signer's signature and name will appear here:</p>
{% if report_signed_by %}
<div class="signature">
<img src="{{ report_signed_by.signature }}" />
<p>Signed by {{ report_signed_by.name }} at {{ report_signed_at }}</p>
</div>
{% endif %}
</div>
{% endblock %}