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:
<ul>
#foreach($row in $result)
<li><strong>${row.Name}: </strong>${row.Population}</li>
#end
</ul>
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“