Back to Devexpress

Group Numbering by Index

xtrareports-404915-feature-guide-to-devexpress-reports-use-expressions-expressions-tasks-and-solutions-group-numbering-by-index.md

latest2.4 KB
Original Source

Group Numbering by Index

  • Feb 18, 2026
  • 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:

View Example: Visual Studio Report Designer - Group Numbering by Index

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() + 1) - adds row indexes.

The following image illustrates the result (report preview):

See Also

Functions in Expressions

Add Grouping Levels