How to Enable Between and Other Operators for DateTime Parameters in the Bold Reports Embedded Designer
Enable parameter operators in the Bold Reports® Report Designer to let users select conditions such as Equal, Greater Than, Less Than, or Between for DateTime parameters. This is useful when readers need to change a report’s date criteria or range at run time instead of requiring a separate report for each filter condition.
Applies to: Bold Reports JavaScript Report Designer embedded in an application. The enableParameterOperator setting is documented for the Report Designer; support in the Report Viewer is not covered here.
Step-by-Step Instructions
Step 1: Enable the Property in Client-Side Code
- Open the JavaScript file where the Report Designer is initialized.
- Locate the initialization settings for the control.
- Add
enableParameterOperatorand set it totrue.
// Initialize the Bold Reports Designer with Parameter Operator enabled
$('#report-designer').boldReportDesigner({
serviceUrl: "/api/ReportDesigner",
enableParameterOperator: true
});
Property Details
| Property | Type | Description |
|---|---|---|
enableParameterOperator |
Boolean | Enables or disables the option to enable operators in report parameters. Set it to true to show the operator option in the Report Designer. |
Step 2: Configure a DateTime Parameter
The operator option applies to parameters with the DateTime data type.
- Open the report’s Parameters pane.
- Create a DateTime parameter or select an existing one and click Edit.
- Confirm that the parameter’s Data Type is DateTime.
- Select Enable Operator in the parameter properties.
- Save the report.
Step 3: Configure the Report to Use the Parameter
Enabling the operator controls the parameter prompt. To use a Between selection in a SQL Server dataset, create two query parameters and map each to one endpoint of the DateTime report parameter.
SELECT EmployeeID, OrderDate
FROM Orders
WHERE OrderDate >= @StartDate
AND OrderDate <= @EndDate
In the dataset’s query-parameter mapping, add these entries:
| Query parameter | Value expression |
|---|---|
@StartDate |
=Parameters!DateRange.Value(0) |
@EndDate |
=Parameters!DateRange.Value(1) |
Replace DateRange with the name of the DateTime report parameter. The Between selection supplies the start date at index 0 and end date at index 1. For a date-only SQL Server column where the end date should include the entire day, use an exclusive upper boundary instead:
WHERE OrderDate >= @StartDate
AND OrderDate < DATEADD(day, 1, @EndDate)
For an Oracle dataset, use the Oracle parameter markers in the query:
WHERE OrderDate >= :StartDate
AND OrderDate <= :EndDate
In the Oracle dataset’s query-parameter mapping, add these entries:
| Query parameter | Value expression |
|---|---|
:StartDate |
=Parameters!DateRange.Value(0) |
:EndDate |
=Parameters!DateRange.Value(1) |
Replace DateRange with the name of the DateTime report parameter. For other providers, use the parameter marker required by that provider and map separate query parameters to =Parameters!DateRange.Value(0) and =Parameters!DateRange.Value(1). Alternatively, configure a dataset filter on the date field with the Between operator. The Report Server configuration steps in KB 21703 enable the same parameter prompt for Report Server; this article covers the embedded Report Designer and dataset mapping.
Step 4: Preview and Verify the Parameter Operators
- Preview the report.
- Locate the DateTime parameter in the parameter pane.
- Click the operator control next to the date input to view available options, such as Equal, Greater Than, Less Than, and Between.
- Select an operator, such as Between, and choose the date range.
- Run the report and confirm the results match the selected condition and date range.
Download a sample application demonstrating this configuration here.