How to Render Reports with a Specific Date Interval in Bold Reports
In Bold Reports, efficiently managing date intervals can significantly enhance user experience and report functionality. By implementing a feature that hides report rendering when the date range selected by users exceeds a predefined limit, you can ensure users are guided to select appropriate filters. This Knowledge Base (KB) provides step-by-step instructions on how to achieve this functionality and implementation details. Some of the benefits of this include limiting the date range helps manage data load and ensures reports focus on relevant data segments. The warning message prompts users to adjust their date filters for a more manageable report size.
Follow the steps below to achieve this requirement:
- Add two datetime parameters named “FromDate” and “ToDate” to capture the desired time intervals from users.
- In the report header, insert a text box and add an expression to display a warning message if the selected date interval exceeds the limit. Use the following expression:
=IIF(DateDiff("d", Parameters!FromDate.Value, Parameters!ToDate.Value) > 30 ,"Since the date interval is more than 30 days. Change the parameters to get the data.","")
-
Design the report layout as required and set its visibility based on the date interval selected by users. In the example, the report is designed with a simple textbox report item.
-
Set the visibility for the textbox report item using the following expression:
=IIF(DateDiff("d", Parameters!FromDate.Value, Parameters!ToDate.Value) > 30 ,True,False)
- Save and preview the report.
In our example, if a user selects a data interval exceeding 30 days, an error message will be shown in the header expression. If the user selects a date interval within 30 days, the report will render.
Output:
Within 30 days date interval
Exceeding 30 days date interval
For your reference, the sample report is also attached here.