The default template of PocketQuery produces a simple Confluence table, enriched by a few gimmicks. The result looks like this:
The table has two columns Name and Population, according to the SELECT clause of the query. This table now already has a few features:
- The table is sortable by clicking the column headers.
- If your string results are very long, they are cut by an ellipsis (…) to avoid bluttering the table.
- Double-clicking the values opens the (complete) strings in a dialog.
Templates for PocketQuery are written in Velocity, a Java templating language used in Confluence. Let’s have a look at the code of the default PocketQuery template that is selected by default for all queries.
Nothing fancy here: there is one loop for the header that runs through the column names and one loop (with another nested loop) running through the result. Note that the variables
$result are passed to any PocketQuery template, so you can use them as you please. For a more formal specification of what kind of objects are available in PocketQuery templates, see the PocketQuery documentation on templates.