A key role of the report template is to manage the format of the data
being displayed. The ReportOutput
object (see Creating a Template Report and
Creating a Velocity Report)
is passed into the template as output and the meta-data is passed in as
meta-data.
AnthillPro ships with 4 standard Report Templates that should meet most of your needs:
Bar Chart. Displays the data in a bar chart embedded in HTML. Data must all be numeric.
CSV. Renders a comma-separated CSV format.
HTML (Anthill Style). Renders HTML output in a table form using the Anthill style.
RSS 2.0. Renders a RSS feed.
If you need to render the report in a different format, follow the instructions below for creating a new template type. Once that is done, the new template type will be available as an option to anyone who runs a report.
Detailed instructions, including examples, on writing Report Scripts is available. To view the documentation, go to Tools and download the Development Kit Bundle. In the scripting directory, open Scripting.pdf and scroll down to the Reporting Scripts section. Urbancode also maintains a publicly available list of report and report-template scripts that may be helpful when writing a custom template. They are viewable here. |
Go to System > Report Template under the Reporting menu. Make sure you have administrative permissions to the System page (see Setting Up Security).
Click the Create Template button.
Name the new template, provide a description (optional), and provide the following:
Content Type. Give the MIME type of the report content. This will be sent to the browser when the report content is generated. E.g.: text/plain, text/csv, or text/html.
Context Script. Optionally, give the context script. For many report templates, the context-script can be left blank.
Template Text. Enter the
content of the template here. A ReportOutput
object
will be automatically provided to the script as "output". The Report
object will also be provided to the script as "report". For an
example, see below.
Click Save.