Date Range Input Control for Build Your Own Reports

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:

last_n_days

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

  • Days

  • Weeks

  • Months

The following image is an example of the configured settings:

last_n_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:

next_n_months

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

  • Months

  • Years

The following image is an example of the configured settings:

next_n_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:

start_end_date

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:

custom_range_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:

duration

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

  • Custom Range

  • Include Time Selection

Allowed Units

  • Minutes

  • Hours

  • Days

  • Weeks

  • Months

  • Years

The following image is an example of the configured settings:

duration_default_value_input

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:

custom_range_parameter

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:

custom_range_query

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:

custom_range_time

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

  • Custom Range

  • Include Time Selection

Allowed Units

All cleared

The following image is an example of the configured settings:

custom_range_time_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

Loading...