ActiveReports for .NET 3 Online Help Request technical support
Walkthrough: Hyperlinks and Simulated Drill-Down Reporting
See Also
User Guide > Samples and Walkthroughs > Walkthroughs > Standard Edition Walkthroughs > Advanced > Hyperlinks Walkthroughs > Walkthrough: Hyperlinks and Simulated Drill-Down Reporting

Glossary Item Box

Hyperlinks can be used in ActiveReports to simulate drill-down reporting.

This walkthrough illustrates how to set up hyperlinks in a report to simulate drill-down reporting.

This walkthrough is split up into the following activities:

To complete the walkthrough, you must have access to the Northwind database.
A copy is located at C:\Program Files\Data Dynamics\ActiveReports for .NET 3.0\Data\NWIND.MDB.

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

Adding three ActiveReports to a Visual Studio project

To add three ActiveReports to a Visual Studio project

  1. Open a new project in Visual Studio.
  2. From the Project menu, select Add New Item.
  3. Select ActiveReports 3.0 File and rename the file rptMain.
  4. Click Open.
  5. Change the BackColor property of the detail section to Thistle
  6. From the Project menu, select Add New Item.
  7. Select ActiveReports 3.0 File and rename the file rptDrillDown1.
  8. Click Open.
  9. Change the BackColor property of the detail section to RosyBrown.
  10. From the Project menu, select Add New Item.
  11. Select ActiveReports 3.0 File and rename the file rptDrillDown2.
  12. Change the BackColor property of the detail section to LightSteelBlue.
  13. Click Open.

Connecting rptMain to a data source

To connect the report to a data source

  1. Click the gray report DataSource icon in the Detail section to open the report DataSource dialog.
  2. Select the "OLE DB" tab.
  3. Click Build.
  4. Select Microsoft Jet 4.0 OLE DB Provider and click Next.
  5. Click the ellipsis to browse for the access path to the Northwind database. Click Open once you have selected the appropriate access path.
  6. Click OK to continue.
  7. In the Query field, type "Select * from customers order by customerID".
  8. Click OK to return to the report design surface.

Connecting rptDrillDown1 to a data source

To connect the report to a data source

  1. Click the gray report DataSource icon in the Detail section to open the report DataSource dialog.
  2. Select the "OLE DB" tab.
  3. Click Build.
  4. Select Microsoft Jet 4.0 OLE DB Provider and click Next.
  5. Click the ellipsis to browse for the access path to the Northwind database. Click Open once you have selected the appropriate access path.
  6. Click OK to continue.
  7. In the Query field, type "Select * from orders where customerID = '<%customerID%>' order by orderdate".
  8. Click OK to return to the report design surface.
  9. Set the report's ShowParameterUI property to False to avoid displaying a UI requesting parameters.

Connecting rptDrillDown2 to a data source

To connect the report to a data source

  1. Click the gray report DataSource icon in the Detail section to open the report DataSource dialog.
  2. Select the "OLE DB" tab.
  3. Click Build.
  4. Select Microsoft Jet 4.0 OLE DB Provider and click Next.
  5. Click the ellipsis button to browse for the access path to the Northwind database. Click Open once you have selected the appropriate access path.
  6. Click OK to continue.
    Setting a default value for the parameter in this query allows you to see fields in the Report Explorer instead of an error message.
  7. Click OK to return to the report design surface.
  8. Set the report's ShowParameterUI property to False to avoid displaying a UI requesting parameters.

Adding controls to display the data

To add controls to the reports

  1. Add the following controls to rptMain, setting their properties as indicated:

    Control Section Location Name DataField Text Miscellaneous
    Label PageHeader 0, 0 lblCustomer Customer ForeColor = Purple; Font = 12pt
    Label PageHeader 1.188, 0 lblCompanyName Company Name ForeColor = Purple; Font = 12pt
    Label PageHeader 3.563, 0 lblContactName  Contact Name ForeColor = Purple; Font = 12pt
    TextBox Detail 0, 0 txtCustomerID CustomerID Customer ID ForeColor = Blue; Underline = True
    TextBox Detail  1.183, 0 txtCompanyName  CompanyName Company Name ForeColor = Black
    TextBox Detail  3.563, 0 txtContactName ContactName Contact Name ForeColor = Black

  2. Add the following controls to rptDrillDown1, setting their properties as indicated:

    Control Section Location Name DataField Text Miscellaneous
    Label PageHeader 0,0 lblCustomerID Customer ID ForeColor = Maroon; Font = 12pt
    Label PageHeader 1.188, 0 lblOrderID Order ID  ForeColor = Maroon; Font = 12pt
    Label PageHeader 2.438, 0 lblEmployeeID  Employee ID ForeColor = Maroon; Font = 12pt
    Label PageHeader 3.625, 0 lblOrderDate  Order Date ForeColor = Maroon; Font = 12pt
    Label PageHeader  4.813, 0 lblShippedDate Shipped Date  ForeColor = Maroon; Font = 12pt
    TextBox Detail 0, 0 txtCustomerID CustomerID Customer ID ForeColor = Black
    TextBox Detail  1.188, 0 txtOrderID OrderID Order ID ForeColor = Blue; Underline = True
    TextBox Detail 2.438, 0 txtEmployeeID EmployeeID Employee ID ForeColor = Black
    TextBox Detail  3.625, 0 txtOrderDate OrderDate Order Date ForeColor = Black
    TextBox Detail  4.813, 0 txtShippedDate ShippedDate Shipped Date ForeColor = Black
  3. Add the following controls to rptDrillDown2, setting their properties as indicated:

    Control Section Location Name DataField Text Miscellaneous
    Label PageHeader 0, 0 lblOrderID Order ID ForeColor = Navy; Font = 12pt
    Label PageHeader 1.188, 0 lblProductID Product ID ForeColor = Navy; Font = 12pt
    Label PageHeader 2.375, 0 lblUnitPrice Unit Price ForeColor = Navy; Font = 12pt
    Label PageHeader 3.563, 0 lblQuantity Quantity ForeColor = Navy; Font = 12pt
    Label PageHeader 4.75, 0 lblDiscount Discount ForeColor = Navy; Font = 12pt
    TextBox Detail 0, 0 txtOrderID OrderID Order ID ForeColor = Black
    TextBox Detail 1.188, 0 txtProductID ProductID Product ID ForeColor = Black
    TextBox Detail 2.375, 0 txtUnitPrice UnitPrice Unit Price OutputFormat = Currency
    TextBox Detail 3.563, 0 txtQuantity Quantity Quantity ForeColor = Black
    TextBox Detail 4.75, 0 txtDiscount Discount Discount OutputFormat = Currency

Adding three Windows Forms with viewer controls to your project

To add three Windows Forms with viewer controls to your project

  1. Change the name of the default Windows Form to frmViewMain.
  2. Place an ActiveReports viewer control on frmViewMain and set its Dock property to Fill.
  3. From the Project menu, select Add Windows Form.
  4. Change the name of the Windows Form to frmViewDrillDown1.
  5. Click Open.
  6. Place an ActiveReports viewer control on frmViewDrillDown1 and set its Dock property to Fill.
  7. From the Project menu, select Add Windows Form.
  8. Change the name of the Windows Form to frmViewDrillDown2.
  9. Click Open.
  10. Place an ActiveReports viewer control on frmViewDrillDown2 and set its Dock property to Fill

Adding code to frmViewMain

To write the code in Visual Basic

To write the code in C#

Adding code to frmViewDrillDown1

To write the code in Visual Basic

To write the code in C#

Adding code to frmViewDrillDown

To write the code in Visual Basic

To write the code in C#

Adding the code needed to set the hyperlink property for rptMain

To write the code in Visual Basic

To write the code in C#

Adding the code needed to set the hyperlink property for rptDrillDown1

To write the code in Visual Basic

To write the code in C#

Viewing the report

To view the report

  1. Add the code needed to set the viewer document of frmViewMain equal to the document for rptMain. See Using the ActiveReports Windows Form Viewer for help.
  2. Click the hyperlink in frmViewMain to drill-down to the next report level.

You can quickly view your report at design time by clicking the Preview tab at the bottom of the designer.

See Also

©2009. All Rights Reserved.