Versions Compared

Key

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

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

Instructions

  1. Make sure that database connection is successful using the SQL for Confluence app.
    1. Select the Image RemovedLog into your Confluence instance as an administrator and navigate to Image Added(Cog wheel) > Manage apps.
    2. Select the 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 an SQL macro inside a Insert SQL macro with a nested Run with a user form and parameters macro: macro.
  3. Insert Enter SQL statement as per the 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 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 in step 3 (PersonID):.
    Image Modified
    .
  6. To enter more than one field, click on click Add field:
    Image RemovedImage Added
  7. Save the  the macro settings and publish the page.
    Image Modified
  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:.
    Image Modified
Info

Any text in the SQL macro body that begins with $

 immediately followed

 followed by a

key will be replaced by

Field key from the Run with a user form and parameters macro is replaced with the values provided in the form.