smilu
smilu

Reputation: 899

How to add multiple reports to the same ReportViewer?

I have a situation here that i'm using a SSRS report for which im sending 4 parameters. For me the Report is Working fine. Now another issue came is that, the customer needs to see multiple reports(Different Data) in the same report viewer ie page by page(clicking the next page).

Im sending the Parameters using a Program? How Can I Achieve this?

ReportViewer1.ServerReport.ReportServerCredentials = new ReportViewerCredentials(UserName, Password, Domain);
ReportViewer1.ServerReport.ReportServerUrl = new Uri(System.Configuration.ConfigurationManager.AppSettings["ReportServerURL"].ToString()); // Report Server URL

string strUrl = string.Empty;
strUrl = WebConfigurationManager.AppSettings["ReportAppName"].ToString() + "/" + ReportName.Trim();
ReportViewer1.ServerReport.ReportPath = "/" + strUrl;

ReportViewer1.ShowParameterPrompts = true;
ReportViewer1.ShowPrintButton = true;
ReportViewer1.ShowExportControls = true;

ReportParameter[] reportParameters = new ReportParameter[4];
reportParameters[0] = new ReportParameter("AccountNo", AccNo, false);
reportParameters[1] = new ReportParameter("ServiceCode", sType, false);
reportParameters[2] = new ReportParameter("BillMonth", Month, false);
reportParameters[3] = new ReportParameter("BillYear", Year, false);

ReportViewer1.ServerReport.SetParameters(reportParameters);
ReportViewer1.ServerReport.Refresh();

In the above application you can see im sending 4 parameters into it. The Application is fine with single Account Number. My new requirement is, I'll be having multiple account numbers from which i need to retrieve data. In a REPORT i should show only data from one Account Number.

I need to show the rest as pages in the same report so when the person clicks on it he/she can navigate through it. Is it possible to achieve this? How can i show it as Pages?

Please help me on this.

So, if i can get this in the same report as pages we can download it also in a single file.

Upvotes: 3

Views: 2697

Answers (2)

g williams
g williams

Reputation: 184

For you sql query that populates your raw data into your report, make two separate queries and then union the results into one return set.

select customer, address, balance, "customer" as Table from customer where balance > 0

union all

select products as customer, price as balance, "products" as Table from products

Assuming you know which product line items you need.Now you have your raw data. You will have multiple tables in your report designer. Filter by the table name to tell which data to go to which table.

Upvotes: 1

g williams
g williams

Reputation: 184

To add multiple reports to one report do a union in the query and use a column as an identifier for which report the data pertains to. You will have to use filler info as a union will not work if the column numbers types and names do not match up.

Now that you have all your data use your report designer for assigning the new report data to a new page. Hope this helps

Upvotes: 0

Related Questions