Reporting - Parameter Enhancements (v19.2)

Reporting Team Blog
27 November 2019

Thanks to your great feedback, we’ve made some important changes to our .NET Reporting platform in this release cycle. In this post, we’ll describe new parameter-related functionality and associated user experience enhancements.

Define Parameter Values via Expression Binding

You can now define the default parameter value via an Expression Binding. Right-click the square icon () to the right of the Parameter.Value editor in the Properties Panel to open the Expression Editor:

Parameter - How to define expression

As you’ll see, we now give you the ability to use static values (like constants) and allow you to work with these values using various expression functions. The expression evaluates before the Parameter Panel renders, so you can’t use report or parameter data source fields and have no access to the other parameter values.

For instance, you can set the default a parameter value to the current date using the Today() function:

Parameter - Expression Tooltip
Note: You can only specify an expression for parameters whose MultiValue property is disabled.

We will extend this functionality in a future release and give you the ability to select all values for a lookup parameter using an expression function.

Please help us improve parameter support by answering the following survey question:

Date Range Parameter

Most reports need to filter information based on date range. To help address this requirement more effectively, we’ve introduced a Date Range parameter type across all supported platforms. You can now create a single range parameter that renders a single editor with a list of predefined ranges in the Parameters Panel.

Note: The Parameter.LookUpSettings property has been renamed to ValueSourceSettings. For more information on this change, please refer to this document: Report Parameters - The LookUpSettings property is hidden

To create a date range parameter, you must:

  • Add a new Date parameter.
  • Set the parameter’s Value Source property to the Range Parameter’s value:
Parameter - Specify Range Settings
  • Expand the Value Source property to define Start and End parameter values using the Value property editors:

Parameter - Provide Start and End Values

Note: You can define the start and end parameter values using an expression binding.

You might notice that the parameter has changed its icon in the Field List to indicate a range. Moreover, the parameter node is expandable and contains two child parameters: Start and End.

Range Parameter - Field List

You can use these parameters to display the date range in a report’s label using the following expression:

FormatString('{0:d} - {1:d}', ?dateRangeParameter_Start, ?dateRangeParameter_End)

Filtering Specifics

The parent parameter visually and logically combines its internal Start and End parameters in the field list: use these internal parameters to filter report data. For example, you can use them when setting the value of the XtraReport.FilterString property:

Filter String Editor - How to Set Up the FilterString

You can also edit a data source query and associate report parameters with query parameters:

Filter String Editor - How to Set Up the FilterString for a Query

In both instances, once you switch to the print preview, you’ll see the date range parameter editor in the parameters panel:

Parameters Panel - Range Parameter Editor

Note that the End parameter’s value uses 12:00AM or midnight for its time value. For instance, if a user selects October 15, 2019, the underlying DateTime value is October 15 2019 12:00:00 AM. Use the GetDate() function in the Filter String editor if you need to include data for the report:

GetDate([PurchaseDate]) Between(?dateRangeParameter_Start, ?dateRangeParameter_End)

Custom Ranges in the Parameter Editor

We’ve made it easier for you to customize the predefined range list. The RangeParameterEditorOptions static class provides a RegisterDateRange method that you can use to add your own date ranges. For instance, call this method at app startup to add the “Last 2 Month” range:

RangeParameterEditorOptions.RegisterDateRange(
    "Last 2 Month",
    () => DateTime.Today.AddDays(-DateTime.Today.Day + 1).AddMonths(-2),
    () => DateTime.Today.AddDays(-DateTime.Today.Day)
);

Use the RangeParameterEditorOptions.PredefinedDateRanges collection to access and modify the predefined range.

Your Feedback Matters

We have plans to extend the list of supported range parameter types and we would like to hear your thoughts on this. Please cast your vote below to help us refine our plans.

Parameters Panel – Reset Button Behavior

We heard you loud and clear about “Reset” button behavior and decided to change it based on your feedback. A “Reset” button click now reverts parameter values back to their defaults, instead of previously submitted values.

See the breaking change that describes this change and describes a way to revert to the previous behavior: WinForms/WPF End-User Print Preview - The Parameters panel’s Reset button has changed its behavior.

Closing

All these enhancements are based on feedback. Please let us know if you have any concerns about the new functionality described herein. We would also like to hear about any parameter-related scenarios that require custom code (to continue our enhancements in this area).

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.