...
...
Scenario
Div |
---|
|
Estimated Time: 8 min |
In this scenario, let's insert the SQL Macro macro on a Confluence page by inserting Markup from the menu. The SQL macro uses the SQL statement loaded into the body of the macro.
Background
This scenario uses a data source profile, called "BookWarehouse" to , to query a database table called ", PUBLISHERS". The table contains the following columns and rows:
...
Info |
---|
For information about data source profiles, refer to: |
The sample query against the PUBLISHERS table looks like:
Code Block |
---|
|
SELECT rank as "Worldwide Ranking", company_name as "Company", format(revenue,0) as "M Revenue" FROM publishers ORDER BY rank asc; |
Steps
The following steps demonstrates how to use Markup to insert the SQL macro on a Confluence page:
Table plus |
---|
border | 0 |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
columnAttributes | style="border:0;width=5%;",style="border:0;width=65%;",style="border:0;width=30%;max-width=30% !important;" |
---|
id | steps_table |
---|
enableSorting | false |
---|
enableHighlighting | false |
---|
|
| Create Confluence pageCreate a Confluence page to add the SQL macro needed to list out top publishers. - Create a page named Top Publishers Worldwide in a space accessible to the desired audience.
- Click Save to save the new page.
| |
| | Insert the SQL Macro macro using the Insert Markup MenuEdit the Top Publishers Worldwide page and: - Select Markup from the top menu.
Type the following into the editor window: (Note the data source 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} |
- Click Insert to insert your Markup within the page.
- Click Save to save your page and view your results.
Alternative:Insert the SQL Macro macro using Markup on pageEdit the Classic Books page and: - On the page, begin typing "{" (open parenthesis) and then type "sql".
- Select SQL from the available list of macros.
- The Macro macro editor dialog appears.
- Select BookWarehouse as the Data source name.
- Type your SQL statement into the body of the macro block.
Click Insert to insert your Markup within the page. - Click Save to save your page and view your results.
|
| How to insert Markup from the menu
Alternate method:
|
|
Explore Tutorials
We've prepared a number of tutorials which demonstrate how to use our SQL macros with the native Chart macro.