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 database connection is successful using the SQL for Confluence app.
    1. Log into your Confluence instance as an administrator and navigate to Image 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.
      Image Added
  2. Insert SQL macro with a nested Run with a user form and parameters macro.
    Image Added
  3. Enter SQL statement as required. In this example, a query to retrieve data from the persons table is used.
    Image Added

  4. Edit the Run with a user form and parameters and click Add my first field in Field settings:
    Image Added
  5. Select Field type and add Field key. Here the field key is considered as per the SQL statement mentioned in step 3 (PersonID).
    Image Added
    .
  6. To enter more than one field, click Add field:
    Image Added
  7. Save the macro settings and publish the page.
    Image Added
  8. Provide input and click Run. Data is retrieved from the database based on given SQL statement and the input data entered in the form.
    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 is replaced with the values provided in the form.