Date ranges allow the user to enter one date and time or a range of dates and times.
Examples
Last N
Allows the user to enter the number of specified time units to filter report data. For example: Last 7 Days. The following image is an example of a Last N date range in a report:
To display a Last N date range, configure the following settings on the Add Report Input dialog box:
Setting |
Selection |
---|---|
Input Variable |
The name you will use as a parameter in the report query. |
Display Name |
The name that will appear as a label for the input in the report. |
Input Variable Type |
DateRange |
Input Control Type |
DateRange |
Hide Input |
Cleared |
Required |
Optional |
Default Value |
7 |
Options |
Last N |
Allowed Units |
|
The following image is an example of the configured settings:
The following syntax is an example query for the duration parameter of the date range:
where startdate >=@duration_from and enddate <= @duration_to
Next N
Allows the user to enter the number of specified time units to filter report data. For example, Next 3 Months. Use input for trending reports. The following image is an example of the Next N date range in a report:
To display the Next N date range, configure the following settings on the Edit Report Input dialog box:
Setting |
Selection |
---|---|
Input Variable |
The name you will use as a parameter in the report query. |
Display Name |
The name that will appear as a label for the input in the report. |
Input Variable Type |
DateRange |
Input Control Type |
DateRange |
Hide Input |
Cleared |
Required |
Optional |
Default Value |
3 |
Options |
Next N |
Allowed Units |
|
The following image is an example of the configured settings:
The following syntax is an example query for the duration parameter of the date range:
where startdate >=@duration_from and enddate <= @duration_to
Custom Range With No Default Value
Allows the user to enter a Start Date and End Date from a calendar to filter the report data. The following image is an example of a Custom date range in a report:
To display a Custom date range, configure the following settings on the Edit Report Input dialog box:
Setting |
Selection |
---|---|
Input Variable |
The name you will use as a parameter in the report query. |
Display Name |
The name that will appear as a label for the input in the report. |
Input Variable Type |
DateRange |
Input Control Type |
DateRange |
Hide Input |
Cleared |
Required |
Optional |
Default Value |
Blank |
Options |
Custom Range |
Allowed Units |
All cleared |
The following image is an example of the configured settings:
The following syntax is an example query for the duration parameter of the date range:
where startdate >=@duration_from and enddate <= @duration_to
Custom Range With A Default Value
You can also configure a custom date range with a default value, such as the current day, by using PnYnMnDTnHnMnS from the XSD (XML Schema Definition) Duration data type. The following image is an example of the custom date range with a default value in a report:
In this example, the default date and time is today's date, two hours before the current time. Configure the following settings on the Edit Report Input dialog box:
Setting |
Selection |
---|---|
Input Variable |
The name you will use as a parameter in the report query. |
Display Name |
The name that will appear as a label for the input in the report. |
Input Variable Type |
DateRange |
Input Control Type |
DateRange |
Hide Input |
Cleared |
Required |
Optional |
Default Value |
-PT2H |
Options |
|
Allowed Units |
|
The following image is an example of the configured settings:
The following syntax is an example query for the duration parameter of the date range:
where startdate >=@duration_from and enddate <= @duration_to
Custom Range Example Query
To use the custom date range input, create a parameter for the date range input. Configure the following settings on the Edit Data Set dialog box:
Setting |
Selection |
---|---|
Parameter |
The Input variable that you configured in the Edit Report Input dialog box. |
Type |
DateRange |
Multi |
Cleared |
Required |
Cleared |
Value |
=input.duration |
The following image is an example of the configured settings:
Then, add the parameter as part of a where clause in the report query in the Query box on the Edit Data Set dialog box:
where startdate >=@duration_from and enddate <= @duration_to
The following image is an example of the configured settings:
Include Time Selection
When a Custom date range is selected, allows the user to also select a specific time from a list. The following image is an example of a Custom date range with a Time Selection in a report:
To display a Custom date range with a Time Selection, configure the following settings on the Edit Report Input dialog box:
Setting |
Selection |
---|---|
Input Variable |
The name you will use as a parameter in the report query. |
Display Name |
The name that will appear as a label for the input in the report. |
Input Variable Type |
DateRange |
Input Control Type |
DateRange |
Hide Input |
Cleared |
Required |
Optional |
Default Value |
Blank |
Options |
|
Allowed Units |
All cleared |
The following image is an example of the configured settings:
The following syntax is an example query for the duration parameter of the date range:
where startdate >=@duration_from and enddate <= @duration_to
Associated Input Variables
- Date Range