Step 1:We will have two reports. The steps to be followed for both the reports are same only in the case of master report we will execute the below query
Collapse | Copy Code
SELECT
[PlayerID]
,[PlayerName]
,[BelongsTo]
FROM [SSRSExperiment].[dbo].[tbl_Players]
And for the Subreport we will execute the below query Collapse | Copy Code
SELECT
[PlayerName]
,[MatchPlayed]
,[RunsMade]
,[WicketsTaken]
,[FeePerMatch]
FROM [SSRSExperiment].[dbo].[tbl_Players]
WHERE [BelongsTo]= @CountryName
Note that, we are passing the @CountryName parameter. So at runtime based on the parameter value passed , the sub report will be generated. Once the reports are created we will have two reports in our project as shown belowTesting the PlayerSubReport alone yields the below result
Step 2:Add a SubReport control in the main/master report.
Step 3:Right Click on the Subreport -> Subreport Properties
Step 4:From the General section of Subreport Properties window, select the subreport name (here it is PlayerSubReport) from the dropdown as shown below
And from the Parameters tab after clicking on the Add button, let us eneter the Parameter name as "CountryName"and the value as " =First(Fields!BelongsTo.Value, "DataSet1")". Once done , click on OK button
Step 5:That's it. Now let us run the report
So our Subreport has been generated.
No comments:
Post a Comment