Skip to main content
Skip table of contents

Creating A Custom Template To Style the Result

To further customize the output of the macro, you can use a custom template. Templates are built using the powerful templating engine Velocity. Go to the PocketQuery administration, choose the tab "Templates" and click "Add Template".

We will use it to print the name of a country followed by its population, so name the template something like "population". For the content use the following code:

    #foreach($row in $result)
        <li><strong>${row.Name}: </strong>${row.Population}</li>

This snippet simply walks through the result row by row and each time prints a new <li> with the content of the columns "Name" and "Population" of the respective row.

Save the template. Then, go to your query and select the new template from the dropdown instead of "default":

Save the query, and press “Test Query“. After entering “Europe“ into the continent parameter we created earlier, you get a completely different looking result:

Let’s continue with “Connecting to the First REST Datasource

JavaScript errors detected

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

If this problem persists, please contact our support.