Paul Usher's Blog

Reporting: New Binding Expressions (v.17.2)

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.



Published Nov 10 2017, 06:35 AM by
Bookmark and Share

Comments

Taradanov

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

November 13, 2017 2:42 AM

Eric Upton 1

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!

November 13, 2017 7:00 AM

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.

November 13, 2017 11:54 AM

Dennis (DevExpress Support)

@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 (www.devexpress.com/bcid=BC4185). Let us know in case of any further difficulties.

November 14, 2017 11:59 PM
LIVE CHAT

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

FOLLOW US

DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2017 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners