Using confluence variables in PocketQuery

We have pages with a large number of pocketquery macros to display different information. All of the queries take a simple alias relating to the page. Currently we have to enter this alias as a parameter for each individual query.

Is there any way to take a confluence variable and use it as a parameter for the PocketQuery statements. Ideally when using the page template the user should be able to enter the alias once and this is automatically used in all queries.

1 answer

Hey Paul,

just letting you know that we have moved our support over to our service desk for PocketQuery.

First you should look and see if wildcards solve your problem.

If this doesn't work you have a second option. So if this "alias" you are talking about is something you can get access to inside a Velocity template (for example the name of the page, or a macro parameter) then you could use


in your template and simply pass the value as a parameter. You could make one big Template, which is responsible for rendering all the other PocketQuery macros. You could then pass this one big Macro a macro parameter of your liking and in the template populate the macro paramter to the other macros.

Have a look at our documentation to see what kind of Velocity objects you can use in your templates and how to use the renderPocketQueryMacro() function.

If you need further help please raise a ticket at our service desk and tell us more about what this alias is supposed to be. :)

Best regards,
Sven (Scandio)

Hi Sven, getting the variable into a velocity object would be the difficult part. I will try with what you have suggested and see how I get on.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

1,118 views 59 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you