Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS: Master-detail report with two datasources

I have two local data sources that I can push into the report. Works no problem. But how do I set up the report? One data source contains a list of employees, and info about them. The other contains a bunch of working hours for each employee.

I would like to use a table for the list of employees, and then have another table for the working hours beneath each employee (with their working hours).

Is this even possible? Do I have to use a Sub-Report? Would I have to merge them into one datasource? =/

like image 200
Svish Avatar asked Apr 28 '09 12:04

Svish


People also ask

How do I use two datasets in one SSRS report?

But we will do that in SSRS side, and which is our requirement. Lets create two embedded data set in SSRS, first one will fetch the Employee details and second will fetch the Department details. Lets take a new report and add a Embedded Data source first then will add Embedded Datasets.

Can SSRS connect to multiple data sources?

Yes, you can use multiple Data Sources. Although you can't join the data. For instance, you can't have a table with fields from both Data Sources. BUT you can have a Data Source from Oracle and a Data Source from MS SQL.

How do I merge two reports in SSRS?

Make a new report that will become your main report. Then, in the body of the main report instead of inserting a table or a textbox you can insert a subreport. Insert three subreports and then go into the properties of each to link them to each report you want to include in the main report.


1 Answers

As far as I can tell, it is impossible to nest one dataset inside of another one without using a subreport.

This means you need to do one of two things:

  1. Refactor your two datasources into a single datasource. For example, perform a join between the employees and the working hours for each employee. You can then use the grouping properties of the Table object to format the list the way you want it.

  2. If joining the two data sources is not practical, you can use subreports to accomplish what you want. Create a subreport containing the working hours data source and give it a parameter for the current employee. Filter the working hours by this parameter.

    In your parent report, you can place the subreport in the list, and pass the employee ID for the current row as a parameter.

    Note that there are a few formatting quirks involved with using subreports. I've been able to work around them in most cases, but the preferred method would definitely be number one above.

like image 139
AaronSieb Avatar answered Oct 26 '22 04:10

AaronSieb