{groovy:output=wiki}
import com.atlassian.renderer.v2.RenderMode
def renderMode = RenderMode.suppress(RenderMode.F_FIRST_PARA)
def choiceSql = "select distinct(year) || ':' || 'Report ' || year || ':' as choice from reports order by choice desc"
def choiceMacro = "{sql-query:datasource=testDS|table=false} ${choiceSql} {sql-query}"
def choices = subRenderer.render(choiceMacro, context, renderMode)
def runMacro = """
{run:id=dynamic|autorun=true|replace=report:2010::select::${choices}}
{sql-query:datasource=testDS}
select * from reports where year = \$report
{sql-query}
{run}
"""
out.println runMacro
{groovy}
|