Detailed Template Example

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

Feature ExampleSyntax
Displaying variables{{ [folder.name](http://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['todo'] %}
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=[300,300]) }}" />
Displaying image regions<img src="{{ snapshot.get_region(bounds=[300,300]) }}" />
{% 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>Untitled Report</h1>
<p>Set the content of your report within the "body" block.</p>
<p>
Use variables passed to the template like this: The name of the case is {{ case.name }}.
See the template designer documentation linked above for all the available features.
</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 'todo' #}
{% for item in static_data['todo'] %}
{# Outputs each item in the 'todo' array #}
<li> {{ item }}</li>
{% endfor %}
{# Outputs string variables 'name' and 'date' from static_data #}
<p>
Name: {{ static_data['name'] }} <br>
Date: {{ static_data['date'] }}
</p>
</ul>
<h2>Images</h2>
<ul>
{# Begins looping through all the images in the currently selected folder #}
{% for im in folder.images %}
{# Creates a bullet list #}
<li>
{# Outputs the properties of each image #}
{# Outputs the image name, ID, filesize #}
{{ im.name|e }} (ID: {{ im.id }}) ({{ im.filesize | filesizeformat }})
{# Displays the actual image as a thumbnail #}
<img src="{{ im.get_thumbnail(bounds=[300,300]) }}" />
{# Displays a portion of the full size image #}
<img src="{{ im.get_region(area=[0, 0, 10000, 10000], bounds=[300,300]) }}" />
</li>
{# Snapshots and snapshot metadata for each image can also be displayed #}
<h3>
Snapshots
</h3>
{# Begins looping through all the snapshots associated with the currently selected image #}
{% for snapshot in im.snapshots %}
<ul>
{# Outputs each snapshots' title and description #}
<li>Title: {{ snapshot.title }}</li>
<li>Description: {{ snapshot.description }}</li>
{# Displays the snapshot with a size of 300px X 300px #}
<li><img src="{{ snapshot.get_region(bounds=[300,300]) }}" /></li>
</ul><br>
{% endfor %}
{% endfor %}
</ul>
<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>
{# Snapshots can also be displayed without accessing their associated image #}
<h2>
Snapshots
</h2>
{# 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 #}
<ul>
<li>Title: {{ snapshot.title }}</li>
<li>ID: {{ snapshot.id }} </li>
<li>Description: {{ snapshot.description }}</li>
{# Displays the snapshot #}
<img src="{{ snapshot.get_region(bounds=[300,300]) }}" />
</ul><br>
{% 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 %}