Skip to end of banner
Go to start of banner

How to display the report for a specific date range using Run and SQL macro

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

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

Instructions

Follow the below steps:

  1. Log into the Confluence instance.

  2. Navigate to the required page and click the Edit icon ().

  3. Add the macro Run with user form and parameters to build the form.
  4. Click Edit to open the macro setting window.
  5. Add the fields to the form based on the field requirement.
    a. Add the date field on the form.


    b. Enter the name of the button you want to display on Form under Run button text
  6. Click Save settings and Save the page.
  7. Add the SQL Query macro under the Run with user form and parameters macro. Enter {sql or search for the SQL for Confluence macro.
  8. Edit the macro and select the Data source profile.
  9. Enter the SQL statement based on the Field key mentioned in the Step5.

    In the below query, used the CAST operator to convert the literal strings '2003-01-01' and '2003-12-31' to the DATE values.

    Select * from tabel_name where column_name BETWEEN CAST('$date2' AS DATE) AND CAST('$date1' AS DATE);


  10. Click Save settings and Save confluence page.
  11. Enter the date range based on your requirements and click Show Data on form.

    Data are shown as below.


The field key used in the Run self-service report macro will be used in the SQL query to input the data.
  • No labels