Setting a Default DateTime Parameter in Bold Reports Report Designer
Overview
This guide explains how to configure a DateTime parameter in Bold Reports Report Designer with a default value of the current date using the =Today()
expression. This feature streamlines user interaction by automatically populating the parameter with today’s date, ensuring that reports reflect the most recent data context by default.
Prerequisites
- Bold Reports Report Designer must be installed.
- An open report project in Report Designer.
- A basic understanding of report parameters and expressions.
- Access to the Bold Reports documentation for reference: Report Parameters and Supported Functions.
Steps to Set a Default DateTime Parameter
Step 1: Create a New Parameter
-
Open your report in Bold Reports Report Designer.
-
In the Report Explorer pane (typically on the left), right-click on Parameters and select New Parameter.
-
Configure the parameter properties:
- Name: Set to
Date
(or a unique identifier likeReportDate
). - Prompt: Set to
Date
(this is displayed to users when running the report). - Data Type: Choose DateTime to support date values.
- Allow Blank Value: Uncheck to ensure a value is always provided.
- Allow Null Value: Uncheck for consistency.
Snapshot: Creating a new parameter in Report Explorer.
Snapshot: Setting parameter properties in the dialog.
- Name: Set to
Step 2: Set the Default Value
-
In the parameter properties dialog, go to the Default Values tab.
-
Select Specify Values under Default Value.
-
Click the Expression button (fx) to open the expression editor.
-
Enter the following expression to set the default to the current date:
=Today()
-
Click OK to save the expression.
-
Save the parameter settings by clicking OK in the properties dialog.
Snapshot: Accessing default value settings.
Snapshot: Opening the expression window.
Snapshot: Setting the
=Today()
expression.
Snapshot: Saving parameter changes.
Step 3: Use the Parameter in the Report
- Dataset Filter (Optional):
- Open the dataset properties used in your report.
- Add a filter using the
Date
parameter, e.g.:=Fields!ReportDate.Value = Parameters!Date.Value
- This filters the dataset to records matching the selected date.
- Report Item Expression (Optional):
- Use the parameter in a text box or chart, such as:
="Report for: " & Format(Parameters!Date.Value, "MMMM d, yyyy")
- This will display the selected date in the report (e.g., “Report for: May 7, 2025”).
- Use the parameter in a text box or chart, such as:
- Save any changes made to the report.
Step 4: Preview and Verify
-
Click the Preview tab in Report Designer.
-
Confirm that the
Date
parameter defaults to today’s date (e.g., May 7, 2025, based on the current date). -
Ensure the parameter dynamically updates to the current date every time the report is run.
-
Test by manually changing the date to verify that the report reflects the selected value.
Snapshot: Previewing the report with the default date.
Troubleshooting
- Verify that the expression is
=Today()
(case-sensitive) in the default value settings. - Ensure that the parameter’s Data Type is set to DateTime.
- If the report does not filter correctly::
- Check the dataset filter expression for correct syntax and field references.
- Confirm the dataset includes a date field compatible with the parameter.
- Timezone issues:
- The
=Today()
expression uses the server’s timezone. For multi-user environments, consider using=Now()
and formatting to extract the date if specific timezone handling is needed.
- The
- Parameter not visible:
- Ensure the Hidden property is unchecked in the parameter properties
Additional References
- Alternative Expressions:
- Use
=Now()
for a default value including both date and time (e.g., “2025-05-07 14:30:00”). - Use
=DateAdd("d", -1, Today())
for setting yesterday’s date as the default. - Parameter Visibility: Set the Hidden property in the parameter properties if the default date should not be modifiable.
- Report Parameters
- Supported Functions.
- Use
Conclusion
Configuring a DateTime parameter with a default value of =Today()
simplifies report generation by automatically populating the current date. This enhances user experience, reduces manual input, and ensures reports remain contextually relevant. Additional expressions and settings can be applied to tailor the parameter for specific scenarios, such as time-sensitive or hidden parameters.