Filtering Subreport Data in Winforms Report

I am using Winforms Reporting Services (RDLC) to generate a subtitled report. My problem is that the subreport is not being filtered by the parent id.

A simple example of a data model would be a Department that contains employees.

In the report, I want to show all departments and have a subheading to show the Workers belonging to that department.

I created a dataset with two DataTables (Department and Employee). I created a relationship between two tables using the DepartmentId column.

In Form I Fill in each table using the appropriate Fill commands. First I populate the Department table and then I populate the Employee table i.e. Selects * From Deparment and Select * from Employee.

Now for real RDLCs: The rdlc department uses the Deparment datasource and shows the department information. I removed the subreport control on this rdlc and configured the properties. I am passing a ReportProperty to a subreport which is Field! DepartmentId.

In Employee rdlc, I added Employee data source and created a filter in Property! DepartmentId.

When I run the report, I can go through each Department, but it doesn't appear in the subreport. If I remove the Filter from the Employee data source, it shows, but displays all employees.

In the form itself, I handle ePropercessing and add the Employee data source to the report.

Any ideas on how to bind the Subreport data to the parent?

0


source to share


1 answer


Pass the id from the parent to the subreport as a parameter, and then filter the table in the subreport based on that parameter value.



MSDN - Configuring Subreport and Drillthrough Reports

+1


source







All Articles