Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Usq sql within a user macro with the sql dynamically constructed


I would like to have a usermacro, taking the name of the page and constructing a sql statement that I could pass to the sql macro.

The outline is : 


#set ($query = "select field1, field2 from somtable where field1 ="+$content.getTitle())

<ac:structured-macro ac:macro-id="f9f4ee50-2e49-463a-8ab5-79cd170f1450" ac:name="sql-query" ac:schema-version="1">
<ac:parameter ac:name="dataSource">mysource</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:parameter ac:name="table">false</ac:parameter>



How do I substitue my $query in the macro ?


Thank you





2 answers

0 votes


are you sure there is a "SQL Query" marco in standard Confluence? I'm not sure about that.




The issue is not with the sql macro, which is not part of confluence, but provided by Bob Swift from Appfire as a very useful plugin.

The issue is how to pass a variable into CDATA[...] for rendering. With the "old" wiki markup, it was possible to use something like



#set ($runMacro =" {sql-query:datasource=source}select somestuff from sometable{sql-query}")



I do not know how to do that with the new format.




Hi @Christophe Bonvin ,

Thanks for raising your query through Atlassian Community and we have raised to support request from our end and please sign up to portal to view the support request.

With the help of Run Macro from Run Self Service Reports app you will be able to configure pre-defined variables  for $page_title and the SQL macro needs to be embedded within Run Macro.

Please find below screenshot for your reference and please note that in below screenshot $page_title will be substituted in SQL macro.

image (2).pngThanks,


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

402 views 23 8
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you