Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Scenario

Div
classtime

Estimated Time: 8 min

In this scenario, we will insert the SQL Macro on a Confluence page by inserting Markup from the menu. Our SQL Macro will reference the SQL statement loaded into the body of the Macro.

Background

Our scenario will use a Data Source Profile called "BookWarehouse" to query a database table called "PUBLISHERS". The table contains the following columns and rows:

...

Table plus
border0
heading0
multiplefalse
enableHeadingAttributesfalse
columnAttributesstyle="border:0;width=5%;",style="border:0;width=65%;",style="border:0;width=30%;max-width=30% !important;"
idsteps_table
enableSortingfalse
enableHighlightingfalse


Create Confluence page

Create a Confluence page that will eventually contain the SQL Macro needed to list out top publishers.

  1. Create a page named Top Publishers Worldwide in a space accessible to the desired audience.
  2. Click Save to save the new page.






Insert the SQL Macro using the Insert Markup Menu

Edit the Top Publishers Worldwide page and:

  1. Select Insert Markup from the top menu.
  2. Type the follwing into the editor window. Note the dataSource name  referenced. 

    Code Block
     {sql:dataSource=BookWarehouse}
     SELECT rank as "Worldwide Ranking", company_name as "Company", 
     format(revenue,0) as "M  Revenue" FROM publishers ORDER BY rank asc;
     {sql}


  3. Click Insert to insert your Markup within the page.
  4. Click Save to save your page and view your results.

Alternative:

Insert the SQL Macro using Markup on page

Edit the Classic Books page and:

  1. On the page, begin typing "{" (open parenthesis) and then type "sql"
  2. Select "sql" from the available list of Macros.
  3. The Macro editor dialog will appear.
  4. Select "BookWarehouse" as the Data source name
  5. Type your SQL statement into the body of the Macro block.
  6. Click Insert to insert your Markup within the page.

  7. Click Save to save your page and view your results.


How to insert Markup from the menu






...

We've prepared a number of tutorials which demonstrate how to use our SQL Macros with the native Chart Macro.

Tutorials