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

$PocketQuery.renderPocketQueryMacro()

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

606 views 20 11
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