Passing parameters to a sub-report
Hi. I've got a report I'm designing for the web using a ReportViewer control and an RDLC report file. Here's what needs to happen in the report,
- The main report calls one stored procedure with some user provided parameters, which returns a dataset.
- A sub-report will use 2 of the columns returned from the dataset above to call another stored procedure, which then provides the dataset used for the ReportViewer control.
I'm lost in trying to implement this. How do I call the first stored procedure to get the data? Then how do I pass the returned columns to the sub-report?
The main report will have a number of these sub-reports, each on its own page. I'm just trying to implement the first sub-report. Is there an easier way to implement this without using sub-reports? Thanks.
[828 byte] By [
arc_dev] at [2008-1-9]
I think I understand what your requirement is:
1) Create the main report A with the stored procedure which creates a dataset and assigns parameters based on the Stored Procedure.
2) Create another report B with its own stored procedure ,which in turn creates parameters for the report.
3) In the main report add a SubReport.
a.) Right click on the SubReport and give a name and select the Report B from the dropdown box.
b.) Go to the Parameters tab on the SubReport and assign the parameters from Report A to Report B. (Make sure the joining parameters match from Report A to Report B ).
Hope this helps....
Thanks, VDeepak. I've heard that in SSRS, sub-reports aren't necessary; multiple data sources can be called and multiple controls populated with data. Considering my requirements, is there a way to display the data on the main report without using a sub-report? Thanks.
I am sure it is possible.
I believe we can accomplish your task my using different Table controls with each seperate Dataset. For better understanding I would use one Rectange for one Table and a Dataset with its own stored procedure.
Rectangle A
Table A (Dataset A)
Rectangle B
Table B (Dataset B)
.
.
.
Hope this helps.