Creating SubReport and filtering SubReport using MainReport Parameters in SSRS
Many times you have a requirement where you want to display a Sub Report inside the Main Report.
for Eg Suppose we have a main Report as Product Category inside Product Category Report we want to Display Products Sub Category also as a Sub Report for these type of Scenario's we used sub Report.
Now you have one More Requirement like you have to filter both Main Report and Sub Report Based
on Main Report filter
For Eg we have to filter Product category and Product Sub Category report based on Parameter Product Name in your main Report.
We will cosider above examples to create Reports
step how to create Sub Report.
we will create two Report Separetely .
1-Create your Main Report name it as Product category.
2-Create two Dataset one for Report Dataset and one for Report Parameter.
3-Add a Report Parameter for the Main Report name it as ProductcategoryName allow multiple values..
4-Select your Tablix add filter where productCategoryName in Parameter Name which is Product CategoryName.
5- Now Create your SubReport name it as Product Subcategory.
6-Create two Dataset one for Report Dataset and one for Report Parameter.
7-Add a Report Parameter for the Sub Report name it as ProductcategoryName allow multiple values.
8-Select your Tablix add filter where productCategoryName in Parameter Name which is Product CategoryName.
9-Drop a Sub Report from Tool Box to Your Main Report.
10-Select subReport Control .
Right click-In General Tab- Select Produect SubCategory-In Use this Report as Sub Report Column.
In Parameter tab-Name your Parameter Name =ProductCategoryName Value @ProductCategoryName
or You can click fx in Parameter value Select Parameter from there also.
Preview the Main Report-The Report Parameter will filter both Reports in your Main Report based on ProductCategoryName
Note:In order to avoid Error Sub Report Cannot be seen always create ReportParameter with same name in Main Report and Sub Report .
Secondly we have created Dataset for Report Parameters in both Reports because we are allowing Multiple values to Report Parameters i.e a user can select multiple Products category fro m Main Report Parameter.
Do you have sample of ssrs report as said above?
ReplyDeleteRegards,
Veasna
grasacFdextku_Bellevue Chris Subramanian download
ReplyDeletesoycedramblips