This example illustrates how to create a hierarchical tree-like report based on data stored in a flat table. Data must meet certain requirements. Two additional fields are necessary to build a tree structure. The first field must contain unique values. The second field must contain values that indicate parent nodes for the current node. Here is a sample image illustrating the required structure.
The example's main report has the Level
parameter to store the quantity of levels of hierarchical data. A value of this parameter is used to generate the initial data table. When the data table has been generated, it is converted to a hierarchical list of custom objects that is used as a report data source. The main report contains an XRSubreport instance that refers to the detail report. The detail report in its turn contains an XRSubreport
instance that recursively refers to itself.
- ChildReport.cs (VB: ChildReport.vb)
- DataHelper.cs (VB: DataHelper.vb)
- Form1.cs (VB: Form1.vb)
- Program.cs (VB: Program.vb)
- TreeReport.cs (VB: TreeReport.vb)
(you will be redirected to DevExpress.com to submit your response)