Skip to main content Skip to footer

How to Drill Through Reports in a C# .NET Application

  • 0 Comments
Quick Start Guide
What You Will Need

Visual Studio

ActiveReports.NET License (Free trial or full license)

Controls Referenced

Table

TextBox

Image

Parameters

Actions

Drill-Through

Tutorial Concept Learn how to create drill-through reports in a C# .NET application using ActiveReports by passing parameters between reports and setting up interactive navigation. This tutorial guides you through defining parameters, dynamically filtering data, and configuring actions to enable seamless report linking for enhanced data exploration.

This blog will show how to drill through from one report to another using ActiveReports. This tutorial discusses how to display a child report when a user clicks on text or an object in the main report.

This blog is accompanied by a video. Both the video and the blog will go through the same steps to achieve the same results. If you'd like to follow the video instead or use both together:

We’ll continue using the report we generated in our Getting Started - How to Create a .NET Report.

Ready to Get Started? Download ActiveReports.NET Today!

As a reminder, this is an inventory report using a table grouped into product categories. It shows each product’s name, color, price, and size.

Drill Through Reports in a C# .NET Application

We also have a second report showing a list of recent orders, including the customer’s name, the quantity they ordered, the price per quantity, any discount we’re giving them, and a total for that line item.

Drill Through Reports in a C# .NET Application

So, the goal here will be to drill through the first report, the Inventory Report, to see the Recent Orders report for a particular product category. If we click on the image of a product category in the Inventory Report, the Recent Orders report for that product category should display.

Defining Parameters for Drill-Through Reports in ActiveReports

First, we’ll create some parameters to hold the ProductID and ProductName of the products we click on in our Inventory Report.

1. Open the Recent Orders report in the ActiveReports Designer.

  • This time, we will use the ActiveReports Visual Studio Integrated Designer as our example. Still, you can also use the ActiveReports Desktop Designer or the ActiveReports Web Designer to do the same thing with similar steps.

2. Right-click on parameters in the Report Explorer and choose Add Parameter.

3. Set the Name to ProductID.

4. Check the checkbox next to Hidden.

  • This will hide the parameter from users so they cannot interact with it directly but allows us to continue using it in the background.

5. Click the green + button at the top of the parameters dialog to add another parameter.

6. Name this one ProductName and change it to Hidden as well.

7. Click OK.

Dynamic Report Titles and Data Filtering with Parameters in ActiveReports

Next, we’ll change the title in our Recent Orders report to include the ProductName stored in our parameter and filter the data in the report by the ProductID.

1. Remove the existing “Recent Orders” text from the title checkbox

2. Replace that old text with an expression:

  • =”Recent Orders for ““&[@ProductName]&””

3. Right-click on the Orders data set and choose Edit

4. In the Parameters tab of the DataSet dialog, add a new parameter

  • Set the Name to QueryParameter
  • Set the value to =Parameters!ProductID.Value

5. Open the Query tab of the DataSet dialog

6. At the end of the query, add the following:

  • where SalesLT.SalesOrderDetail.ProductID = @QueryParameter

7. Click OK

Adding Interactive Drill-Through Actions to Images in ActiveReports

Now, we can jump back into the Inventory Report, where we’ll add an Action event on the image to allow users to click on it to open the Recent Orders report for the pictured product.

1. Open the Inventory Report in the ActiveReports Designer

2. Select the image control embedded in the first cell of the table and open the property dialog box

3. Open the Navigation tab in the Image dialog

4. Select Jump to report and set the dropdown to our Recent_Orders report

5. In the table below the dropdown, we’ll need to add two parameters: the parameters we’re passing into our Recent Orders report. The names of these parameters should match the ones in our Recent Orders report.

  • Name: ProductID, Value: =Fields!ProductID.Value, Omit: false
  • Name: ProductName, Value: =Fields!Name.Value, Omit: false

Drill Through

And that’s it! Everything should be working the way we planned now. If you click on a product image in the Inventory Report, it should drill through to the Recent Orders for that product.

Final Drill Through

Drill-through reports in ActiveReports provide a seamless way to navigate between related datasets, offering users a more interactive and insightful reporting experience. By setting up parameters, dynamically filtering data, and linking reports through interactive actions, you can create reports that allow users to explore details on demand. Whether you are using the Visual Studio Integrated Designer, the Desktop Designer, or the Web Designer, ActiveReports makes it easy to implement drill-through functionality with minimal effort.

By following the steps outlined in this guide, you can enhance your reports to provide deeper insights and a more engaging user experience. Try implementing drill-through reports in your own applications to see how they improve data exploration and usability. If you have any questions or want to explore more features, check out the ActiveReports documentation and community forums for additional support.

Ready to Get Started? Download ActiveReports.NET Today!

Tags: