Thursday, June 9, 2011

ActiveReports: Grouping

We've used Grape City's (formerly Data Dynamics) ActiveReports off and on for many years. I'm not truly a fan since personally I've never found it that intuitive, but for flexibility they're pretty good.

Recently I ran into a quirk I've encountered before but had forgotten. I won't call it a bug since we're using it in a manner that is undocumented and most likely not supported.

Since AR uses (or appears to use) DataBinder.Eval to evaluate the DataField on each object in the DataSource of a report, we have always used collections of domain objects for our report sources. This works well for textboxes, however, when you try to do a standard report grouping (with header and footer) you'll get stuck wondering why the report only seems to recognize one group. Specifically this occurs when you use a property path of depth greater than one.

The following works:
myTextbox.DataField = "Property1.Property2";
myGroupheader.DataField = "Property1";
This does not:
myTextbox.DataField = "Property1.Property2";
myGroupheader.DataField = "Property1.Property2";
The textbox will populate correctly but the report will only discover one group of records.

No comments: