Versions Compared

Key

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

This article explains how to use SQL for Confluence with Run Self Service Reports to display dynamic content on a page.

Instructions

  1. For dynamic value substitution, you need to use $ with the field name. Write a SQL Insert a Run with a user form and parameters macro in a Confluence page and edit the macro to provide field values for the form as shown:
    Image Added
  2. Insert an SQL macro inside the Run macro and write a SELECT statement in the SQL macro settings as shown below:

    Code Block
    themeMidnight
    Select CREATOR, CREATIONDATE from SPACES WHERE SPACEID='$Space Id' AND SPACEKEY='$Space Key';
    Add the above query inside a run

    Image Added

    Info

    Any text in the SQL macro body that begins with $ followed by a Field key from the Run with a user form and parameters

    macro and provide field values for the form by editing the run macro as shown below screenshot:
    Image Removed
    Image Removed

     macro is replaced with the values provided in the form.


  3. Provide the values for the fields as shown below and click on run button and result of the macro with get displayed. 
    Image Removedand click Run to display the results.

Consider the following sample data and click Run:
Image Added

The query results are displayed as:
Image Added

Info

This example is

from the SQLServer database

for an SQL Server database. If needed, you can modify the query as per your database, before using it. We recommend testing the query in your database before using it in your production environment.