Lesson 4 - Create a Report with a Document Map
- 3 minutes to read
This tutorial illustrates how to group data in a report, and then implement a Document Map, which reflects the report's structure and provides the navigation through its bookmarks. In addition, this tutorial will show you how to calculate common summary functions in your report.
In this tutorial, we will use the report created in the preceding lesson: Lesson 1 - Create a Static Report.
Perform the actions below to implement a Document Map for a report with groups in a Silverlight application.
Create a Report with Groups
- Bind the report to the Products table from the Northwind database (in the nwind.mdb file located in the directory where you installed DevExpress demos). These steps are similar to those explained in Lesson 2 - Create a Data-Aware Report.
To provide detail data to a report, drop the Products item from the Field List onto the Detail band.
To group detail records in a report, switch to the Group and Sort Panel, click Add a Group and choose the CategoryID field from the drop-down list.
Then, enable the Show Footer check box to add an associated Group Footer band to your report. If required, you can change the Sort Order as well.
You can learn more about grouping at Group and Sort a Report's Data.
To reflect the group title in a report, drop the CategoryID item from the Field List onto the Group Header band.
Calculate a Summary for Groups (Optional)
You can calculate various summary functions in your report. The following steps illustrate this process.
First, make a copy of the label residing in the Detail band and place it onto the Group Footer.
In the invoked Summary Editor, set Summary function to Count, enable the Ignore null values check box, and set the Summary Running to Group.
You can learn more about available summary functions at Shaping Data (Legacy Data Bindings).
Provide Bookmarks to the Report
The Document Map is auto-generated for a report, which has controls with defined bookmarks. The following steps demonstrate how you can do this.
To provide a bookmark to the report, set its XtraReport.Bookmark property.
For data-bound controls, you can bind their XRControl.Bookmark property to the required data field.
So, let's define a bookmark for the control that resides in the Group Header.
Then, do the same for the label residing in the Detail band.
For this label, you can also specify the XRControl.BookmarkParent property, which defines the nested hierarchy of the Document Map.
View the Result
The report with groups and a Document Map is now ready. Run the application and view the result.