Versions Compared

Key

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

This article explains how to input data

...

using a form and retrieve

...

the results from the database

...

using the Run Self-Service Reports for Confluence and SQL for Confluence apps respectively.

Instructions

  1. Make sure that a database connection is successful using the SQL for Confluence app.
    1. Select the Cog wheel Image Removed > Manage apps
    2. Select the Log into your Confluence instance as an administrator and navigate to Image Added(Cog wheel) > Manage apps.
    3. From the left sidebar, select the SQL app > View and modify data source profiles and  and ensure that connection to the database is successful.
      Image Modified
  2. Insert the SQL macro inside a run macro:Insert SQL macro with a nested Run with a user form and parameters macro.
  3. Insert the Enter SQL statement as per the requirementrequired. In the this example below, we considered retrieving data from the table persons:, a query to retrieve data from the persons table is used.

  4. Edit the Run macro and add with a user form and parameters and click Add my first field in Field settings:
    Image Modified
  5. Select the Select Field type and add Field key. Here  Here the Field field key is considered as per the SQL statement mentioned above that is PersonID:in step 3 (PersonID).
    Image Modified
    .
  6. To enter more than one field click on , click Add field:
    Image RemovedImage Added
  7. Save the Macro settings: the macro settings and publish the page.
    Image Modified
  8. Enter the details Provide input and click Run.  As per the Data is retrieved from the database based on given SQL statement and details the input data entered in the form on the confluence page, data will be retrieved from the SQL database and will be shown on the confluence page:.
    Image Modified
Info

Any text in the SQL macro body that begins with $ immediately followed  followed by a key found in the replace parameter list will be replaced by the value. Values will be provided by a user submitting a form from the page based on the replace parameter. Default values can be specified Field key from the Run with a user form and parameters macro is replaced with the values provided in the form.