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
- Make sure that a database connection is successful using the SQL for Confluence app.
- Select the Cog wheel > Manage apps
- Select the Log into your Confluence instance as an administrator and navigate to Cog wheel) > Manage apps.
- From the left sidebar, select the SQL app > View and modify data source profiles and and ensure that connection to the database is successful.
- Insert the SQL macro inside a run macro:Insert SQL macro with a nested Run with a user form and parameters macro.
- 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.
- Edit the Run macro and add with a user form and parameters and click Add my first field in Field settings:
- 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).
. - To enter more than one field click on , click Add field:
- Save the Macro settings: the macro settings and publish the page.
- 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:.
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. |