How can I use macros from someone else inside my own macro

Deleted user March 3, 2013

Hey there,

I want to create a simple macro, where a user has to put in a number, which is afterwards used inside another macro to do a database request.

So now my question is, how can I call a macro within my macro? Or is this even possible?

Kind regards,

Christopher Graß

3 answers

1 accepted

0 votes
Answer accepted
Sean King
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.
March 7, 2013

You can use another macro inside your user macro with this:

<ac:macro ac:name="profile">
    <ac:parameter ac:name="user">$content.getCreatorName()</ac:parameter>
</ac:macro>

Naturally you'd be using a different name and different parameter values based on what the macro your including uses.

0 votes
Deleted user March 4, 2013

I managed to do it by using the action.getHelper() method, rendering the whole content into xhtml.

Thanks for helping me.

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
March 3, 2013

Within your macro, construct the appropriate wiki markup or xhtml markup and render it using the appropriate renderer.

For a user macro it would be something like this when using wiki markup:

$action.getHelper().renderConfluenceMacro("{noformat}stuff{noformat}")

Deleted user March 3, 2013

I m afraid I don't know what you exactly mean by "appropriate renderer".

Do you mean I have have to choose the correct rendering definition when I want to create a macro?

Let's say, I want to use the SQL macro, this is how I started.

## @param PfNummer:title=Nummer|type=string|required=true


{sql:dataSource=myDB} 
select value1,value2
from test_table where pf_value3='$paramPfNummer' 
{sql}

The input variable gets replaced inside the sql string, but obviously the macro does not execute the sql string.
Any idea how I can solve this problem?

Deleted user March 3, 2013

Edit: I am currentyl working with Confluence version 4.3

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events