In this video, we’re going to 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.
We’ll continue using the report that we generated in our Getting Started - How to Create a .NET Report video.
As a reminder, this is an inventory report using a table that is grouped on product categories. It shows each product’s name, color, price, and size.
Also, I 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.
We want 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.
We need to pass at least one parameter from the Inventory Report to the Recent Orders to place a filter on the product category we select.
Title the Recent Orders report to include the name of the product that we just clicked on.
We will start by adding the Recent Orders report to the Visual Studio project. With the Recent Orders report now open in the Visual Studio, add two parameters.
In the ActiveReports 12 Report Explorer, right click on the Parameters node and add a parameter. Name this parameter ProductID and click the Hidden checkbox.
The hidden checkbox hides this parameter from the user, so they don’t know about this parameter and won't interact with it.
In the same Parameters dialog box, click the green plus icon to add a second parameter to the report. Name this parameter the ProductName.
Again, make this a hidden parameter. Click OK to close this dialog box.
In the design view, include the value of the ProductName parameter in the TextBox used for the title of the report. Change the plain text value to an expression that will include both text and parameter value.
In order to filter the data by the product category, we need to edit the query in this report. To do so, right-click on the Orders data set and select Edit.
In the Parameters Tab, create a parameter, name it QueryParameter and pass the value from the ProductID report parameter.
On the Query tab, modify the query to filter the data based on the parameter. Click OK to close the Data Set dialog box.
Back on the Inventory report, set an Action event on the image. To do this, select the image embedded in the first cell of the table and bring up the Property Dialog box.
Under the Navigation tab, I will select Jump to report and then select the Recent Orders report from the drop-down.
We will need to add two parameters to pass to the Recent Orders report. Make sure that the Names here match the parameter names assigned in the Recent Orders report. Click OK to close.
When we view the Inventory Report, we can drill through to the Recent Orders report and show a list of customers who have ordered the products I click on.
Viewing the Inventory Report, we can drill through to the Recent Orders report and show a list of customers who have ordered the products clicked on products.
Drill Through Reports in ActiveReports video tutorial:
Additional tutorials are available on our ActiveReports blog page. Develop and deploy custom enterprise .NET reports with these award-winning complete reporting solutions by downloading a free 30-day trial.
Get ActiveReports Developer Download the latest version of ActiveReports
Get ActiveReports Developer
Download the latest version of ActiveReportsDownload Now!