Hierarchical Report

<< Click to Display Table of Contents >>

RayVentory Data Hub > 12.5 u5 > Dashboards and Reports Customization Guide > Designing Reports > Create Reports 

Hierarchical Report

This tutorial describes how to use the detail band's Hierarchy Print Options property to create a hierarchical report.

 

eurdhierarchicalreportresults

 

1.Create a new report or open an existing one.

2.Bind the report to a data source.
 
eurdhierarchicalBindtheReport
 
Each record in the data source should include a field that defines the parent-child relationship and thus builds the hierarchy.

3.Arrange controls on the report.

oAdd the Report Header and Page Header bands (see the Manage Report Bands | Add Bands section in the Introduction to Banded Reports document for details).

oAdd data-bound labels to the Detail band.
 
eurdhierarchicalMarketShareReport
 
Switch to PREVIEW to see an intermediate result.
 
eurdhierarchicalPreviewReport
 

4.Switch back to DESIGN, select the Detail band, and type in "hier" in the Search field to navigate to the Hierarchy Print Options property pane.
 
eurdhierarchicalreportprintoptions
 
Set the following options:

oKey Field Name and Parent Field Name, or Child List Field Name.
Set the Key Field Name and Parent Field Name properties if your report's data has the Id-ParentID related fields.
Set the Child List Field Name property if your report's data is recursive. Assign the collection of child objects (records) if they have the same type as the parent objects (records).

oIndent
Specify the child level node offset.

oKeep Together with First Child
Specify whether to print a parent node together with its first child node on the next page if these nodes do not fit at the end of a page.

 

5.Preview the result.
 
eurdhierarchicalOptions
 
As you can see in the image above, the Detail band that contains child rows is printed with the specified indent. However, the row (the sum of the label widths) does not fit the page now.

6.Align labels.

oAnchor the first data-bound label to the Detail band's left and right edges. Set the label's Anchor Horizontally property to Both.
 
eurdhierarchicalreportanker
 

oAnchor the rest of the data-bound labels to the right edge of the Detail band (their container). Set their Anchor Horizontal property to Right.
 
eurdhierarchicalreportAnchorProperties

 

7.Preview the result.
 
eurdhierarchicalreportresultscreen
 

8.Add a drill-down control to expand/collapse child rows.

 

oAdd a Check Box control to the Detail band at the left-most position.
 
eurdhierarchicaladdcheckboxcontrol
 

oSet the Check Box control's glyph options and remove the unnecessary "checkBox1" text. You can specify different images to indicate the checkbox state. In the Custom Glyphs section, specify the moveup image for the Checked state, and the movedown image for the Unchecked state.
 
Hierarchiereportscheckbox
 

oSet the Detail band's Drill Down Control property to the added Check Box control.
 
hierarchicalReportsdrilldowncontrol
 

oClick the f-button next to the Check Box control to invoke the Expression Editor, and assign the following expression to the Check State property:
Iif( [ReportItems.Detail1.DrillDownExpanded],  'Checked''Unchecked')
 
HierarchicalReportsExpressionEditor
 

oPreview the result:
 
HierarchicalReportsPreviewResult

 

9.Sort report data.
Use the Detail band's Sort Fields property to sort data.
 
HierarchicalReportsSortFieldsProperties
 
Preview the result:
 
hierarchicalreportsSortFieldResults
 

 

10.Highlight root nodes.
To format rows based on their nesting level, use the CurrentRowHierarchyLevel variable in expressions. Specify the following expressions for the Detail band's appearance properties:
 
Background Color:
Iif([DataSource.CurrentRowHierarchyLevel] == 0, Rgb(231,235,244), ?)
 
Font | Bold:
[DataSource.CurrentRowHierarchyLevel] == 0
 
HierarchicalReportsExpressionEditorBold
 
Preview the result:
 
HierarchicalReportsHighlightedRootNodes