Group Numbering by Index
- 2 minutes to read
The following topic explains how to build a report that displays a multi-level numbered list. For this purpose, report controls use GroupIndex()
and CurrentRowIndexInGroup()
functions in their data binding expressions to return group and row indexes.
The following image illustrates the resulting report that groups products by category and discontinued state:
Prerequisites
The following example implements the report that you see in this tutorial:
Create Expressions for Groups
Place an XRLabel or XRTableCell control into a group header. Bind the control to an expression that displays the group number.
Use GroupIndex()
to obtain the group index. Pass the GroupBand.Level property value as a parameter. A level value of 0 means that a GroupBand
is the direct parent of the DetailBand
. The level values increase as you go up to the root.
The following image demonstrates XRTableCell
controls placed into GroupHeader
and Detail
bands:
The cells specify the following data binding expressions:
- “Category Name” group:
GroupIndex(1) + 1
- displays indexes of root-level groups.- “Discontinued” group:
GroupIndex(1) + 1 + '.' + (GroupIndex(0) + 1)
- adds second-level group indexes.- The detail band:
GroupIndex(1) + 1 + '.' + (GroupIndex(0) + 1) + '.' + (CurrentRowIndexInGroup(0) + 1)
- adds row indexes.
The following image illustrates the result (report preview):