Skip to main content

Master-Detail Report with Detail Report Bands

  • 2 minutes to read

This tutorial illustrates how to display hierarchical data in a master-detail report using nested Detail Report bands. This technique is effective if your data source contains a master-detail relationship. Another technique is described in the following topic: Master-Detail Reports with Subreports).

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

  2. Bind the report to the required data source and set up a master-detail relationship as described in the Bind a Report to a Database topic.

  3. Drop data fields of the main table from the Field List onto the Detail band.

  4. Right-click the report and select Insert BandDetailBand to create a Detail Report Band.

    Select the Detail Report band and select the master-detail relationship’s name in the Data Member property’s drop-down list.

  5. Switch to the Field List, select the data fields while holding down CTRL or SHIFT and drag-and-drop them onto the Detail band.

    Drag fields from the data category that matches the current detail level, that is, the table specified in the innermost report’s DataMember. This ensures that each detail record is displayed correctly.

    You can display parent values in a detail row using expressions, for example, [Categories.CategoryName]. If a field is not found at the current level, the expression engine automatically resolves it from the parent level.

    However:

    • If multiple levels contain the same field path, the result may be ambiguous, and a value from an unintended level may be used.
    • If you use a field from another table within the same data source, the first record from that table is shown for all rows.
    • If you use a field from a different data source, no data is displayed.
  6. Customize the report’s appearance and format values.

Switch to Preview to see the resulting report.