Versions Compared

Key

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

This article explains how to input data through a form and retrieve data from database(SQL) using run self-services and SQL macro. In the below article we used SQL for Confluence app to connect with the database.

Instructions

  1. Make sure that a database connection is successful using SQL for Confluence app.
    1. Select the Cog wheel Image Added > Manage apps
    2. Select the SQL app > View and modify data source profiles and connection to the database is successful.

      Image Added
  2. Insert the SQL macro inside a run macro:
    Image Added
  3. Insert the SQL statement as per the requirement. In the example below, we considered retrieving data from the table persons:
    Image Added

  4. Edit the Run macro and add Field settings:
    Image Added

  5. Select the Field type and add Field key. Here the Field key is considered as per the SQL statement mentioned above that is PersonID:
    Image Added

  6. To enter more than one field click on Add field:
    Image Added
  7. Save the Macro settings:
    Image Added

  8. Enter the details and click RunAs per the SQL statement and details 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 Added


Info

Any text in the macro body that begins with $ immediately 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.