Reporting: New Binding Expressions (v.17.2)

Paul Usher's Blog
10 November 2017

In the v17.2 release, DevExpress Reporting has taken a big step to simplify the report creation process for end-users and introduced a new way for providing data to report controls and shaping data. Instead of using data bindings as in earlier versions, reports now use binding expressions by default.

Previously, end-users need to handle script events to implement any custom logic in reports, which has certain security implications and requires familiarity with programming languages. Newly introduced binding expressions cover most scenarios of using scripts and make it much simpler to evaluate summary results and conditionally format report data. You can now assign values to not only a limited number of bindable properties, but virtually to any other property of a target report control. 

It’s considerably easier for end-users to internalize expressions’ criteria syntax instead of writing code in script event handlers. 

With expressions mode enabled, the Properties grid contains the special Expressions tab providing properties for which you can specify custom expressions. Clicking the property’s ellipsis button invokes the Expression Editor, which has been improved to provide access to report bands and controls as well as to special property values.

A new approach brings almost no changes to traditional ways of binding report controls to data. As before, you can drag and drop the required item form the Field List, or click the control’s smart tag and select the data field from the drop-down list.

Starting with v17.2, you can invoke the Expression Editor and specify a complex binding expression involving two or more data fields (as you did for calculated fields in earlier versions).

Expressions also enable end-users to evaluate custom summary results without handling script events. Select the range for which to calculate the summary and click the Expression’s property ellipsis button. In the invoked Summary Expression Editor, a new Summary category appears where you can find summary functions whose names start with the "sum" prefix that is added to make it easy to differentiate aggregate functions from report summary ones.

With binding expressions, you are no longer required to create formatting rules and assign them to controls. You can provide conditions for the control’s individual appearance settings or for the style name (in case of multiple appearance changes). 

You can specify which binding mode your reports use by setting the static UserDesignerOptions.DataBindingMode property. This property is available in the Report Designer Options dialog in Visual Studio at design time.

Currently, the following binding modes are available:
- Standard Data Bindings – the legacy binding mode available in all previous versions.
- Expressions (simplified) - the default mode used in newer report versions. With this mode, you can solve tasks that previously required you to handle the BeforePrint script event.
- Expressions (advanced) – this mode enables you to provide expressions in both the BeforePrint and PrintOnPage events.

To help you migrate your existing reports to use the new binding mechanism, we’ve provided an automatic report conversion tool. When the static UserDesignerOptions.ConvertBindingsToExpressions option is enabled for your end-user reporting application, when opening a legacy report, an end-user is prompted to convert this report to use a new binding mode. The Report Designer Options dialog in Visual Studio contains this option as well.

Consider the following cases in which a report cannot be converted:
- A report contains one or more controls bound to a data source, which is not assigned as the report’s data source.
- A report contains a formatting rule, whose data source differs from the report’s data source.
Note that backward conversion of reports (from using expressions back to legacy bindings) is not available.

As always, we would love to hear your thoughts on this new feature.

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.

Wow! The best news so far! I hope XAF and Web will gain the same functionality!

13 November 2017
Eric Upton 1
Eric Upton

Paul, this is a very good improvement. It opens up a world of more flexibility for reporting. Having used Crystal reports extensively in the past, this type of functionality was one of the things I felt was missing with regards to flexibility in DevExpress Reports. I think it will be much simpler to create dynamic user generated reports with the binding expressions.

Is there any news on how this will impact XAF reporting? Will it be available immediately or will the XAF team need time to implement the changes required to use this?

Thanks for the continued improvements!

13 November 2017
Michael Proctor [DX-Squad]
Michael Proctor [DX-Squad]

Looks great, i rsn into that problem a couple of years back where expression fields confused my end users and the ability to do conditional fields was only by script. This is a great improvement. good work guys.

13 November 2017
Dennis (DevExpress)
Dennis Garavsky (DevExpress)

@XAFers: Yes, we worked together with the XtraReports team to ensure that this will work fine with the XAF report modules (both old and new ones). You may also find a corresponding note about this important change + migration guidelines in the What's New section for XAF ( Let us know in case of any further difficulties.

14 November 2017

Great job no doubt. An eagerly awaited feature.

sumSum is bit awkward though.

1 December 2017

Please login or register to post comments.