[{"id":"425f2be4-b65d-4cdf-b543-fb4397f51672","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"a1041c29-1f9f-497e-b577-3e673e487c51","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"c1e3b2a0-7159-4980-a5e1-4fbb04c7fcc1","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"128acbbc-5c49-416b-9c1f-91f679362b23","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"3bc7a653-1dd3-4a33-b35c-41b0ddc2f446","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"cecedb46-bf12-401c-a04c-5282e11b8274","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"2f1768df-3e8b-41c2-826e-93f1a82273d1","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"d9528848-3bae-42c1-8f6d-410a78341cef","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"2683b3de-5c23-429d-9a88-4917616d20ad","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"b96827a0-6bd4-4184-86a4-6fe503d0e4b4","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"96d2140c-5bb6-49b6-a4c7-4af4b7de2e52","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"11f27d32-9547-4a8c-9e88-5dd2bffffeda","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"d186bc7e-cbae-4d23-9cd9-a54880be8e4d","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"26754bf1-707e-4815-b6d3-dcdc87a59188","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"e4c0a89e-cceb-4863-a30a-dff94f1d8d08","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"c4f826a6-5d16-4399-8f1a-7b8449594941","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"ff2b9815-2596-47f7-8793-3585c9ee24a2","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"46851ce2-51a2-4af4-969d-9fe989997135","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"e3e87330-5250-4923-9cdf-e7e8afd353ab","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"a04db983-f77b-4ec6-857c-1c01afaed85a","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"434eed34-9059-46e4-88f9-15e47d09622c","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"30988f2a-ebd5-4a8c-b20e-54a11a528d30","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"a59719c8-0df2-44e1-b89c-9d8fa0312857","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"4be1ecee-287b-43a2-ba99-cfa89de88187","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"ea04cced-7866-48e5-a5fe-1e9f11004d59","tags":[{"product":null,"links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3","name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]},{"id":"ab17d080-0112-4ba4-8dae-ef367bec7b78","tags":[{"product":null,"links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e","name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601"}]}]
Hierarchical Drill-Down Reports allow readers to progressively expand branches of a hierarchical tree to drill down into more granular details. Examples of such reports are an organizational hierarchy and a chain store hierarchy.
This tutorial builds the Chain Store Report
from the ground up, providing experience with the typical report designing process. By the end, you will be able to do the following:
Create a new report
Bind the report to an embedded JSON data
Create a Table data region and bind it to the data
Configure a hierarchical grouping for the Table
Use recursive summary functions
Use the Level
function
Upon completing all tutorial steps, the final report will look like this: live demo.
The following content assumes that you have the Standalone Report Designer
running. Visit the tutorial for detailed information.
In the standalone report designer, click the File menu and select the Continuous Page Layout template for a newly created report. Click anywhere on the gray area around the report layout to load the report properties in the properties panel. In the Margins section, set the Style property to Narrow
to change the report page margins size.
Expand to watch creating a new report in action
Data Binding establishes a connection between a report and the data it displays. For this demo, we use the JSON file that contains the data describing the store chain of a fictitious company called Contoso
that is a manufacturing, sales, and support organization with more than 100,000 products. You can download the file into a folder of your choice on your machine.
Using the following steps, you can create a Report Data Source that establishes the connection to the aforementioned JSON file.
Open the Data panel of the property inspector and click the Add button.
In the Data Source editor dialog, type CustomerOrders
in the NAME field.
Select the Embedded JSON
for the Data Provider
.
Click the Load From File
section and select the downloaded CustomerOrders.json
file.
Click the Save Changes button
Expand to watch adding a data source in action
For static JSON data, a Data Set identifies a JSON path that extracts the array of data objects. In a simple scenario, as in the data this article uses, the data itself is an array of objects.
Use the following steps to add the Stores
data set:
Click the +
icon near CustomerOrders
in the Data panel.
In the Data Set Editor dialog, type Stores
in the NAME field, and $.*
in the Json Path
field.
Click the Validate
button.
Ensure that the DataBase Fields
section displays the [5 items]
text.
Expand to watch adding a dataset in action
A Table is a data region containing a ton of features, and it allows building a hierarchical drill-down as well. There are several ways to add a new table into the report. We will use the quick way for this tutorial:
Expand the Stores
data set in the Data panel using the chevron-down icon.
Click the Select fields
icon on the right side of the Stores
data set name.
Select the Name
, the EmployeeCount
, and the SellingAreaSize
fields.
Drag and Drop selected fields into a top-left corner of a report layout.
Expand to watch adding a table in action
Each record in the Stores
dataset has the Id
and the ParentId
fields that establish the hierarchical relation between parent and child entities. Follow the next steps to configure the newly added table so that it renders in a hierarchical drill-down manner.
Click anywhere inside the table so that it displays the group editor.
Click the <Detail Group>
item within the group editor.
In the properties panel set the Name
property to GroupById
.
Click the +
sign on the right side of the Group Expression
property and choose the Id
field in the drop-down list on the newly added item.
Expand the Parent
property drop-down and select the ParentId
field.
Set the Hidden
flag in the Visibility
section.
Expand the Toggle Item
drop-down and pick the TextBox4
item.
Expand to watch configuring hierarchical drill-down in action
The table we are building displays the Store/City/Region/Country Name
in the first column, the Total Employee Count
in the second column, and the Total Selling Area Size
in the third column. Based on this information, let's configure columns properties:
Click anywhere inside the table to display the columns and rows handlers.
Click the first column handler and set its Width
to 3.5in
in the Properties panel.
Switch to the TEXTBOX tab in the Properties panel. You can now modify the properties of all the table cells of a selected column.
Set the Text Align
property to Left
.
Set the Vertical Align
property to Middle
.
Expand the Padding editor
using the icon on its right side and set the Left Padding
property to 16pt
.
Expand to watch formatting columns in action
In the same manner, set the following properties for the 2nd and 3rd column
Property | Value |
---|---|
Column Width | 2in |
Text Align | Right |
Vertical Align | Middle |
Right Padding | 16pt |
We use the table header row to display headers for displayed fields:
Click anywhere inside the table to display the columns and rows handlers.
Click the 2nd cell of the first table row and type Total Employees
.
Click the 3rd cell of the first table row and type Total Selling Area(ft2)
.
Click the first row handler and set its Height to 0.5in
in the Properties panel
Switch to the TEXTBOX
tab in the Property inspector. You can now modify the properties of all the cells of the selected row.
Set the Background Color
property to #f8f8f8
.
Expand the Border Style
editor using the icon on its right side and set the Bottom Border Style
properties to Solid
.
Set the Border Color
property to #e6e6e6
.
Set the Text Color
property to #3da7a8
, and the Font Weight
to Bold
The Detail Row
of the table repeats for each store with an unique Id
. We configure it so that it displays hierarchical drill-down properly:
Click anywhere inside the table to display the columns and rows handlers.
Click the second row handler and set its Height
to 0.4in
in the Properties panel.
Switch to the TEXTBOX
tab in the Property inspector. You can now modify the properties of all the cells of the selected row.
Expand the Border Style
editor using the icon on its right side and set the Bottom Border Style
properties to Solid
.
Set the Border Color
property to #e6e6e6
.
Click the first cell of the second table row, expand the Padding editor
using the icon on its right side and set the Left Padding
.property to {Level() * 12 + 12}pt
. The Level
function returns the index in the drill-down hierarchy.
Click the second cell of the second table row, and set the Value
property to {Sum(EmployeeCount, "GroupById", "Recursive")}
and the Format
property to n0
.
Click the third cell of the second table row, and set the Value
property to {Sum(SellingAreaSize, "GroupById", "Recursive")}
the Format
property to n0
.
We now add one more table header row to display a heading text.
Click anywhere inside the table to display the columns and rows handlers
Right-click the first row handler and select the Row > Insert Row Above
item in the drop-down menu
Click the handler of the newly selected row and set its Height
property to 0.8in
in the Properties panel.
Switch to the TEXTBOX
tab in the Properties panel.
Set the Text Color
property to #3da7a8
, Font Size
to 22pt
, Font Weight
to Bold
, and the Vertical Align
to Middle
Expand the Padding
editor using the icon on its right side and set the Left Padding
property to 16pt
Click the first cell of the first row, press the Ctrl
button on Windows or Cmd
on Mac OS, and click the 2nd and 3rd cells on the same row.
Right-click on the selection and select the Cells > Merge Cells
item in the drop-down menu. The row now has a single cell that occupies three columns.
Double-click the merged cell and type Stores Report
.
You can now preview the report output and expand collapse product entities using the + icon on the left side of an entity name. Note that summary values of parent nodes include values of child nodes.
The final version of the report is available at the demo web-site.