Can Pocket Query use Velocity variables?

Arne Schirmacher August 4, 2015

I have a database that contains meta data for Confluence pages, referenced by the Confluence content id.

Is it possible to pass the content id of the current page to Pocket Query somehow, for example by using $content.getContentIdAsString()? The Bob Swift SQL plugin can do this.

3 answers

1 accepted

2 votes
Answer accepted
Felix Grund (Scandio)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2015

Hi Arne,

In that case, you'd need a wildcard parameter for the macro browser. According to the PocketQuery documentation, the following wildcards are available:

  • @userName – the username of the current Confluence user
  • @userFullName – the full name of the current Confluence user
  • @userMail – the email address of the current Confluence user
  • @page – the page title of the current Confluence page
  • @spacekey – the space key of the current Confluence page

Since there is currently no wildcard for the current page's ID, I implemented this improvement. Could you install this version of PocketQuery I created for you and test in the following way if it solves your issue...

Statement:

SELECT ... WHERE val = :pageid AND ...

Then in the macro browser, you simply enter @pageid for the variable "pageid". If it doesn't work, please check the "debug" checkbox in the macro browser and report the error message shown.

Note that :pageid will actually be transformed to a string. So your statement will become like this:

SELECT ... WHERE val = '50' AND ...

If this must be a number instead, I'll have to look for another way. 

As soon as your issue is solved, I'll create a new release and upload it to the Marketplace. I'm looking forward to your feedback!

Regards, Felix (Scandio)

 

Arne Schirmacher August 5, 2015

Excellent, the new version works and is exactly what we need. Thanks a lot.

Felix Grund (Scandio)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2015

Thank you Arne! I created the new version 1.14.7 and uploaded it to marketplace. You should replace the temporary version I sent you with this one. And if you like PocketQuery, we'd be very happy about a little review at the marketplace :)

0 votes
Arne Schirmacher August 4, 2015

Yes I need the page id in the SQL query, not in the template. My query looks somehwat like 'SELECT ... WHERE val=$page.getContentId() AND ...'

Please advise how to pass the value from the template to the actual SQL query.

0 votes
Felix Grund (Scandio)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2015

Hi Arne,

Thank you for your interest in PocketQuery! This should be easy to achieve if you already have a custom template, since you have the current page object available as $page. This is the object of type com.atlassian.confluence.pages.Page and you can call all available methods on it. In your case, this will most probably be getId() or getIdAsString().

If you need to pass the ID as macro parameter to a PocketQuery macro, things are a little differently. In that case, please let us know!

Regards, Felix (Scandio)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events