Book a Demo
Prev Next

Creating a Template Fragment

A Template Fragment can return data from either an SQL Query or Model Scripts. The process of defining the content of a Template Fragment depends on which type of data you want your Template Fragment to return; the choices being:

  • Normal Document Template model data - the Template Fragment operates in the same way as a normal template
  • Template Selector - to define a template that calls in other Template Fragments depending on the element type being reported on
  • Custom SQL - to refer to the data returned by a custom SQL Query
  • Custom Scripts - to refer to data returned from a Model Script
  • Document Script - to identify a Model Script to be used by your Template Fragment; the script must return either an empty string or a string that contains raw RTF
  • Custom XML Script - to create a query to report values from an XML file produced by a previously-generated script, such as the data from a simulation; the query operates on static data that is not being continually or automatically updated

In all cases the process is very similar to creating a normal document template.


Use one of the methods outlined here to open the 'New Document Template' dialog.


Publish > Model Reports > Templates : New icon. New Template icon

Keyboard Shortcuts

F8 > Templates : New


In the 'Resources' tab of the Browser window, expand the Document Publishing folder, then:

  • Expand the folder Custom Templates | right-click on the folder Fragments | Create Template or
  • Expand the folder Custom Templates | expand the folder Fragments | right-click on <template name> | Copy or
  • Expand the folder System Templates | expand the folder Fragments | right-click on <template name> | Copy

Create a new Template Fragment



See also


Using one of these methods, display the 'New Document Template' dialog.

Document Templates


In the 'New Template' field, type the name for the Template Fragment.


In the 'Template Type' field, click on the drop-down arrow and select the 'Fragments' option.


In the 'Copy Template' field, click on the drop down arrow and select either:

  • 'None', to create an empty Template Fragment to develop from scratch, or
  • The name of an existing Template to act as a base


In the 'Template Group' field either:

  • Click on the drop-down arrow and select an existing group from the list, or
  • Type a name to generate a new template group, or
  • Leave this field blank, to not place the Template Fragment in a group

The Template Group determines the location of the Template Fragment in the 'Resources' tab of the Browser window.

Browser - Resources


Click on the OK button.

The Document Template Designer displays in the Diagram View.

Design Custom Document Templates


Define the contents of your Template Fragment; the actual steps you follow depend on the data source you want the Template Fragment to operate on:

  • Normal Document Template model data
  • Template Selector
  • Custom SQL
  • Custom Scripts
  • Document Script
  • Custom XML Script
How to Define a Document Script Fragment How to Define a Custom XML Script Fragment Design Custom Document Templates How to Define a Custom SQL Fragment How to Define a Custom Script Fragment How to Define a Template Selector Fragment


Once you have created the Template Fragment, you incorporate it into a normal template (or into an existing Template Fragment, if you prefer).

Adding Fragments to a Document Template


  • Custom Queries and the Custom template section can only be used in Template Fragments; they cannot be used in normal, full-document templates
  • As with normal document templates, Template Fragments can also be created and opened via the 'Resources' tab of the Browser window
  • Template Fragments in the 'Resources' tab are held in a Fragments folder in each of the Document Publishing > System Templates and Document Publishing > Custom Templates folders, and are indicated by a T symbol
  • If you have an existing template that you want to use as a Template Fragment, copy the template as the base of a new Fragment
  • Filtering operates only for the template in which it is set, and does not propagate through sub-templates/fragments; you can set filtering for each sub-template separately, in the Document Options for the sub-template
  • If you embed a Template Fragment within another Fragment, report generation from the parent template will be slower
  • If you have a column or node with the name EABOOKMARK, this will insert a document bookmark around the parent section in the 'Contents' panel

Learn more