HierarchyPrintOptions.ParentFieldName Property
Specifies the name of the field that stores a data object’s (record’s) parent object ID.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v19.1.dll
NuGet Packages: DevExpress.Reporting.Core, DevExpress.WindowsDesktop.Core
Declaration
Property Value
Type | Default | Description |
---|---|---|
String | String.Empty | The name of the field that stores a data object’s (record’s) parent object ID. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to ParentFieldName |
---|---|
DetailBand |
|
Remarks
Set the KeyFieldName and ParentFieldName properties if your report’s data have the Id-ParentID related fields.
public class DataSource {
public static List<SalesData> GetData() {
List<SalesData> sales = new List<SalesData>();
sales.Add(new SalesData(0, -1, "Western Europe", 30540, 33000, 32220, 35500, .70));
sales.Add(new SalesData(1, 0, "Austria", 22000, 28000, 26120, 28500, .92));
sales.Add(new SalesData(2, 0, "Belgium", 13000, 9640, 14500, 11200, .16));
//...
sales.Add(new SalesData(17, -1, "Eastern Europe", 22500, 24580, 21225, 22698, .62));
sales.Add(new SalesData(18, 17, "Belarus", 7315, 18800, 8240, 17480, .34));
sales.Add(new SalesData(19, 17, "Bulgaria", 6300, 2821, 5200, 4880, .8));
//...
return sales;
}
}
public class SalesData {
public SalesData(int id, int regionId, string region, decimal marchSales, decimal septemberSales, decimal marchSalesPrev, decimal septermberSalesPrev, double marketShare) {
ID = id;
RegionID = regionId;
Region = region;
MarchSales = marchSales;
SeptemberSales = septemberSales;
MarchSalesPrev = marchSalesPrev;
SeptemberSalesPrev = septermberSalesPrev;
MarketShare = marketShare;
}
// A node's ID in the hierarchical structure
public int ID { get; set; }
// A node's ParentID in the hierarchical structure
public int RegionID { get; set; }
public string Region { get; set; }
public decimal MarchSales { get; set; }
public decimal SeptemberSales { get; set; }
public decimal MarchSalesPrev { get; set; }
public decimal SeptemberSalesPrev { get; set; }
public double MarketShare { get; set; }
}
After you specify the KeyFieldName-ParentFieldName property pair, the report’s Detail band is printed in tree mode.
Note
Tree mode is supported for recursive data and data with ID-ParentID related fields. Specify either the ChildListFieldName property or the KeyFieldName-ParentFieldName property pair.
Tip
Online Example: How to Create a Hierarchical Report in Code