Versions Compared

Key

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

This article explains how to display the provides step-by-step instructions to generate and display a report for a specific date range using the Run Self-Service Reports and SQL for Confluence app apps.

Instructions

Follow the below steps:

  1. Log into the your Confluence instance.

  2. Navigate to the required page and click the Edit icon (Image Removed)click Image Added.
  3. Add the macro Insert Run with a user form and parameters to build macro to build the form.
  4. Click Edit to open the macro setting settings window.
    Image RemovedAdd the fields to the form based on the field requirement.
    Image Removed
    Image Removed
    Image RemovedImage Added
  5. In Field settings, click +Add field to add fields to the form. Ensure to select Field type as Date for at least two fields so as to provide a date range.
    Image Added
  6. Enter the name of the button in the Run button text field. This ensures that a button with the given text is displayed on the form.
    Image Added
  7. Click Save settings and Save the page.
    Image RemovedAdd the The form is displayed as follows:
    Image Added
  8. Insert SQL Query macro under inside the Run with a user form and parameters macro. Enter {sql or search for the SQL for Confluence macro.
    Image RemovedEdit the macro and select the Data source profile.
    Image Removed

    Image Added
  9. Edit the SQL Query macro to open the settings pop-up.
  10. Select the required Data source profile from the drop-down.
    Image Added
  11. Enter the SQL statement based on the Field key mentioned in the Step5step 5.
    In the below following query, used the  the CAST operator is used to convert the literal strings '2003-01-01' and  and '2003-12-31' to the DATE  to DATE values.

    Code Block
    languagesql
    Select * from tabeltable_name where column_name BETWEEN CAST('$date2' AS DATE) AND CAST('$date1' AS DATE);


    Image RemovedImage Added

  12. Click Click Save settings and Save confluence the page.
  13. Enter the date range or select the dates based on your requirements the date format mentioned in step 5, and click Show Data on the form.
    Image Removed
    Data are shown as below.
    Image Removed
    Image Added

The given example displays the following information:
Image Added
If the user entered a date in an incorrect format (that is, not in the format as specified in the Date format field in step 5), error messages are shown as:
Image Added

Info
The field Field key used in the Run self-service report macro will be used in is to input data using the SQL query to input the data.