Skip to main content
Skip table of contents

Adding Parameters to Your Query

We will now polish up the query by making it more flexible and the result more beautiful. Go back to the PocketQuery administration using the link from the cog menu. Go to "Queries" and click the entry in the list on the left to open and edit your query.

In the statement remove the part "Europe" and replace it with :continent. A colon marks a PocketQuery parameter. Each time when adding the macro to a page, the user can set the value for it. The default parameter type is String, which means the value of the parameter will be enclosed by double quotes - which is exactly what we need in this case. Additionally, further specify the SELECT clause to get only the columns that are of interest (Code, Name, Continent, Region and Population).

Save the query and click on “Test Query“. You can now specify the parameter named "continent" that we just defined in the query and thus change the statement that is executed in the background. Press the “Preview“ in the top of the dialog. Thanks to the shorter SELECT clause the resulting table will have fewer columns and look much leaner.

Now, visit the page you added the PocketQuery-Macro earlier. You most likely will encounter an error message looking like this:

Edit the page, and edit the PocketQuery-Macro. Set the continent-Parameter to “Europe“, save the macro and the page. You should get a result looking like this:

Let’s continue with “Creating A Custom Template To Style the Result

JavaScript errors detected

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

If this problem persists, please contact our support.