Report Templates 1.0
Posted by Mont Rothstein on 12 April 2012 08:19 PM
Report Templates 1.0
This document covers the 1.0 format of Report Templates. The 1.0 version of report templates applies to Adams versions up to 4.4.
Report templates are based on HTML. The template is standard HTML with tokens that are replaced by the report engine. The report engine scans the template looking for square brackets  (a token). It then processes the instructions within the brackets and replaces token (the brackets and everything in between) with the resulting content. The resulting HTML is then converted into a PDF.
Template => HTML content => PDF
Any HTML editor or plain text editor (such as Notepad) can be used. The Microsoft Visual Web Developer 2010 Express is free and has a graphical as well as a source view.
There is a standard token as well as several special token types.
The structure of standard tokens is as follows:
[(Required Type)(Pre HTML)FIELDPATH(Date Format)(Post HTML)]
Note: Contiguous newlines, tabs, and other whitespace within the brackets are compressed into a single space. This mimics HTML.
This is an optional parameter. Allows a data type to be specified that the value must match to be displayed.
The format is the keyword "Type" followed by a colon and the data type followed by another colon.
If the value returned by the Field Path does not match the specified type then the token is removed and nothing is inserted.
This is an optional parameter. It allows HTML to be inserted before the token value only if a value exists.
The format is raw HTML followed by a vertical bar.
This is mandatory. The field path specifies the specific piece of data that will be inserted in the report.
Field paths start from the request the report is being run for and consist of a dot separated path up to and including the field whose value is to be inserted into the report. This can be a field on the request itself, on a related item such as the Folder (case), or on a custom field within the request.
For more information on field paths see: Request Type Field Paths
If the field path results in a value that is a date and/or time then an optional date/time format can be specified. The format is a colon followed by the format.
Valid formats can be found here: http://msdn.microsoft.com/en-us/library/zdtaw1bw(v=vs.90).aspx
This is an optional parameter. It allows HTML to be inserted after the token value only if a value exists.
The format is a vertical bar followed by raw HTML.
Images are handled differently than other values. The image token must be placed inside of a HTML img element. The image token has its own format.
This is a mandatory key word followed by a colon.
This is a standard field path as with other tokens but the resulting value must be one of the following: Asset (either a standard or custom field), Exhibit custom field type resulting in an Asset, Annotation custom field type.
The parameters allow the width, height, resolution, and orientation to be specified. The format is a colon followed by a comma separated list.
Width - This is a mandatory field. The value is the image width in inches. Ex: 2 or 4.5
Height - This is a mandatory field. The value is the image height in inches. Ex: 3 or 7.25
Resolution - This is an optional field. The value is the image resolution in dots per inch (dpi). The default value is 300. Ex: 150 or 200. Warning: values above 300 are unlikely to improve the output quality and may result in the report failing if too much memory is used.
Orientation - This is an optional field. The value is either Portrait or Landscape. The default value is Portrait. A value of Landscape rotates the image 90 degrees clockwise.
CSS Style - The style value for the <img> element is used to format the image as it will appear on the page. The "margin" property sets the margin that will appear around the image. The order of the values is Top, Right, Bottom, Left. The "width" property sets the width of the image. Either the "width" or the "height" CSS style property must be used. If both are used the image will most likely be distorted (stretched or squished). The Width, Height, and Resolution properties set for the "Image" keyword determine how the image is prepared but not how it displays on the page.
Ex: a 2in x 3in 300 dpi image in portrait orientation with a quartet inch margin on the right:
<img style="margin: 0in 0.25in 0in 0in; width:2in;" src="data:image/jpg;base64,[Image:FIELDPATH:2,3,300,Portrait]">
FIELDPATH would be replaced with a valid path.
A special token that will insert the current date and time. A format for the date/time must be provided as well.
A special token that causes all following tokens to insert error messages instead of silently ignoring errors.