Skip to main content
Skip table of contents

Templates

A template defines how the results form the datasource are displayed. There is a separate article Templating Tutorial with various examples on templating in PocketQuery. In the following you will find the more technical documentation that lists all available objects and functions provided by PocketQuery.

Properties

Each template entity consists of the following properties:

  • Name: The name identifying the template. Names must start with a letter and only contain letters [A-Za-z_-], numbers, hyphens and underscores.

  • Content: Velocity/HTML code for the template. It can contain arbitrary Velocity, HTML, CSS or JavaScript code (within <script> tags) to arrange the data of your result. 
    Note: It might be helpful to start with the default template and then adjust it to your needs step by step. Click the text link on the top right above the content field to get the code inserted.

Template Configuration Parameters

PocketQuery provides some additional parameters for the template configuration that are defined within the template content itself. They can be set using (exactly) the syntax “## @param key:value“.

PocketQuery will read your configuration parameters and do smart things with them. Currently, the following parameters are available.

## @param emptymsg:The query returned no result!

Specify what information message PocketQuery should print if the query returned no results.

Available Velocity Objects

Velocity enables you to use a number of variables and call methods on specific objects. You can find all variables and objects that are available when writing PocketQuery templates in the Velocity API Available In Templates.

Google Charts

The Google Charts library is embedded in PocketQuery and PocketQuery exposes a simple JavaScript API on the global PocketQuery object. This makes drawing Google Charts in templates very simple. A PocketQuery template rendering the query result table with Google Charts is as easy as <script>PocketQuery.chart()</script>. See the documents Javascript API Provided By PocketQuery and Templating Tutorial for further information.

Gauge chart example

Bar chart example

Pie chart example


Default And Example Templates

PocketQuery uses a default code snippet for templates which you can find in our example section: Default PocketQuery Template For further information and examples on templating in PocketQuery, refer to our article Templating Tutorial. For further information on the Velocity templating language, refer to the official website.

Continue with Converters

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.