Versions Compared

Key

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

This article explains how to input data through using a form and retrieve the results from a the database using the Run Self-Service Reports for Confluence and SQL for Confluence apps respectively.

Instructions

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

  4. Edit the Run with a user form and parameters and click Add my first field in Field settings:

  5. Select Field type and add Field key. Here the Field field key is considered as per the SQL statement mentioned above in step 3 (PersonID):.
    .
  6. To enter more than one field, click Add field:
  7. Save the macro settings and publish the page.

  8. Provide input and click Run.  As per the above Data is retrieved from the database based on given SQL statement and the input data entered in the form, data is retrieved from the database:.

Info

Any text in the SQL macro body that begins with $ immediately followed  followed by a Field key from  from the Run with a user form and parameters macro will be is replaced by with the values provided in the form.

...