Glossary Item Box

Samples | Walkthroughs | OutputFormat Strings

See Also ActiveReports for .NET 2 Online Help Send feedback to Data Dynamics

Walkthrough: Master Detail Reports with XML Data

ActiveReports allows you to create Master Detail reports with data from an XML database.

This walkthrough illustrates how to create a Master Detail report using XML data and grouping.

This walkthrough is split up into the following activities:

To complete the walkthrough, you must have access to the XML Customer database (Customer.xml).

When you have completed this walkthrough, you will have a report that looks similar to the following.

Adding an ActiveReport to a Visual Studio project

To add an ActiveReport to your project

  1. Open a new project in Visual Studio.
  2. Click on Project > Add New Item.
  3. Select ActiveReports file and rename the file rptMD.
  4. Click Open.

Connecting the report to a XML data source

To connect the report to a data source

  1. Click on the yellow report DataSource icon in the Detail section. This brings up the report DataSource dialog box.
  2. Click on the Data Source drop-down arrow and select XML.
  3. Click on the ellipsis beside File URL to browse for the access path to Customer.xml. Click Open once you have selected the appropriate access path.
  4. In the Recordset Pattern field, type "//ITEM".
  5. Click OK to return to the report design surface.

Adding controls to the report to contain data

To add controls to the report

  1. Add two GroupHeader/Footer sections to your report.
  2. Make the following changes to the group header below the page header:
    • Change the name to ghCustomer
    • Change the DataField property to ../../@id
  3. Make the following changes to the group header above the Detail section:
    • Change the name to ghOrders
    • Change the DataField property to ../Number
  4. Add the following controls to ghCustomer:

    Control DataField Name Text/Caption Location
    Label (Empty string) lblID ID 0, 0
    Label (Empty string) lblEmailAddress E-mail Address 2, 0
    Label (Empty string) lblName Name 4, 0
    TextBox ../../@id txtID ID 0, 0.25
    TextBox ../../@email txtEmail E-mail 2, 0.25
    TextBox ../../@NAME txtName Name 4, 0.25

  5. Add the following controls to ghOrders:

    Control DataField Name Text/Caption Location
    TextBox ../NUMBER txtNumber Number 1, 0
    TextBox ../DATE txtDate Date 4.510, 0

  6. Add the following controls to the Detail section:

    Control DataField Name Text/Caption Misc Details Location
    Label (Empty string) lblISBN ISBN (Empty string) 0, 0
    Label (Empty string) lblBookTitle Book Title (Empty string) 1.437, 0
    Label (Empty string) lblPrice Price (Empty string) 5.458, 0
    Label (Empty string) lblAuthor Author (Empty string) 3.187, 0
    Label (Empty string) lblPublisher Publisher (Empty string) 4.312, 0
    TextBox @isbn txtISBN ISBN (Empty string) 0.0625, 0.312
    TextBox TITLE txtTitle Title (Empty string) 1.437, 0.312
    TextBox AUTHOR txtAuthor Author (Empty string) 3.187, 0.312
    TextBox PUBLISHER txtPublisher Publisher (Empty string) 4.312, 0.312
    TextBox PRICE txtPrice Price OutputFormat = Currency 5.437, 0.312

  7. Add the following controls to GroupFooter2:

    Control DataField Name Text/Caption Misc Details Location
    Label (Empty string) lblSubtotal Subtotal (Empty string) 3, 0
    TextBox PRICE txtSubtotal Subtotal OutputFormat = Currency

    SummaryType = SubTotal

    SummaryGroup = ghOrders

    4, 0

Viewing the report

To view the report

  1. Add the ActiveReports viewer control to a Windows Form.
  2. Add the code needed to set the viewer document equal to the report document. See Using the ActiveReports WinForm Viewer for help.

Samples | Walkthroughs | OutputFormat Strings

 

 


Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.