Grouping Data Overview
In Telerik Reporting, data items can aggregate and summarize data, display it in visual hierarchies, or create different views, thus helping the user/decision maker understand and analyze data in a more efficient manner.
In Telerik Reporting, groups are named sets of data that are bound to a data item. You specify groups by defining their names and grouping criteria (expression).
To create a grouping expression you add Grouping objects to the Grouping collection. The set of group expressions can be a single data field reference or a combination of multiple expressions. At runtime, group expressions are combined and applied together to the data.
Depending on the grouping expressions, groups may be static, dynamic, or detailed:
-
Static groups are defined by empty (no) expression or expression that evaluates to the same value, disregarding the data (ex.:
=1 + 2
). Static groups always produce a single member that contains all the data. - Dynamic groups are defined by expressions that produce different results according to the current data (ex.: =Fields.County). This way the items of the data source are partitioned into groups according to the values of the grouping expressions.
- Details groups are defined by a single Grouping object that has no expression (empty Grouping ) and produces one member for each item of the data source. Detail groups can be applied to Table, Crosstab or List items; for backward compatibility reasons, the Report item treats the detail groups as static groups.
Groups support filtering and sorting that allows you to limit and order the members of the group according to your needs. For more information see Filtering Data and Ordering Data.
Groups are internally organized as members of one or more hierarchies for each data item. A group hierarchy has parent/child groups that are nested and can have adjacent groups. As groups have names, the group hierarchy defines the named scope hierarchy for the report items and expressions.
Data items support groups in different manners according to their structure and application. The following list summarizes how the data items work with groups:
- Report – Report groups are defined by adding Group objects to the report’s Groups collection. Report groups are always nested according to the order in the Groups collection. To display group data one should use the GroupHeaderSection and GroupFooterSection that appear once for each group member, respectively at start and end. The DetailSection displays detailed data in a report and always appears inside the innermost group (if any).
-
Table item – If you think of the parent/ child groups as a tree structure, each group hierarchy is a forest of tree structures. The Table data item includes row and column group hierarchies. Data associated with row group members expand horizontally across the page and data associated with column group members expand vertically down the page. The Group Explorer tool window displays row group and column group members for the currently selected Table data item on the design surface. To create a group one should create a TableGroup object and add it to the corresponding group hierarchy. According to their different specialization, the three derivatives of the Table item works with groups in a different manner:
- Table – define nested row groups and adjacent row groups. By default, a table includes a details group.
- Crosstab – define nested row and column groups, and adjacent row and column groups.
- List – by default, supports the details group. Typical use is to support one level of grouping.
Graph item – The data may be grouped in Categories and Series.