Skip to main content
A newer version of this page is available.

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

  1. 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.
  2. To provide detail data to a report, drop the Products item from the Field List onto the Detail band.

    wpf-lesson-4-03

  3. 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.

    wpf-lesson-4-04

  4. 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.

    wpf-lesson-4-05

    Note

    You can learn more about grouping at Group and Sort a Report’s Data.

  5. To reflect the group title in a report, drop the CategoryID item from the Field List onto the Group Header band.

    wpf-lesson-4-06

Calculate a Summary for Groups (Optional)

You can calculate various summary functions in your report. The following steps illustrate this process.

  1. First, make a copy of the label residing in the Detail band and place it onto the Group Footer.

    wpf-lesson-4-07

  2. Then, click the label’s smart tag, and in its actions list, click the ellipsis button for the XRLabel.Summary property.

    In the invoked Summary Editor, set Summary function to Count, enable the Ignore null values check box, and set the Summary Running to Group.

    wpf-lesson-4-08

    Note

    You can learn more about available summary functions at Calculate Summaries.

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.

  1. To provide a bookmark to the report, set its XtraReport.Bookmark property.

    wpf-lesson-4-00

  2. 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.

    wpf-lesson-4-09

  3. Then, do the same for the label residing in the Detail band.

    wpf-lesson-4-10

  4. For this label, you can also specify the XRControl.BookmarkParent property, which defines the nested hierarchy of the Document Map.

    wpf-lesson-4-11

View the Result

The report with groups and a Document Map is now ready. Run the application and view the result.

sl-lesson4-result