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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • 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

Hi,

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>
<ac:plain-text-body><![CDATA[$query]]></ac:plain-text-body>
</ac:structured-macro>

 

 

How do I substitue my $query in the macro ?

 

Thank you

Christophe

 

 

 

2 answers

0 votes

Hi,

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

Best

JP

Hi, 

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}")

$action.getHelper().renderConfluenceMacro($runMacro)

 

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

 

Regards,

Christophe

Hi @Christophe Bonvin ,

Thanks for raising your query through Atlassian Community and we have raised to support request https://bobswift.atlassian.net/servicedesk/customer/portal/1/SUPPORT-3076 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,

Avinash

Suggest an answer

Log in or Sign up to answer
TAGS
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