Introduction
This article shows how to create a report that expects a parameter, in other words, a parameterized report. We pass CountryRowId as the parameter and we get all the states of that country.
Contents
SSRS Report with Parameter
Step 1
- In order to create a shared dataset, right-click on "Shared Datasets" and click on "Add New Dataset".
![add new dataset]()
Step 2
- Provide an appropriate name of dataset.
- Select the data source.
- Select the "Stored Procedure" radio button and provide the Stored Procedure name.
![choose datasource]()
Step 3
- Now let's add the report. Right-click on "Reports", select "Add" and click on "New Item…".
![add report]()
Step 4
- Select Report and provide an appropriate report name.
![report name]()
Step 5
- To add a parameter, right-click on "Parameters" in Report Data and click on "Add Parameter…".
![adding parameter]()
Step 6
- Provide a parameter name and change its visibility to visible.
![report parameter properties]()
Step 7
- Add a data source in the report data.
- Right-click on "Data Sources" and click on "Add Data Source…".
![adding datasource]()
Step 8
- Provide a data source name and select a data source reference.
![datasource reference]()
Step 9
- Add the data set to the report data.
- Right-click on "Datasets" and click on "Add Dataset…".
![dataset adding]()
Step 10
- Provide the data set name and select shared data set.
![shared dataset]()
Step 11
- Open the report file.
- Right-click on the design surface, select "Insert" and click on "Table".
![inserting table]()
Step 12
- It will add a table to the report design surface.
- Set "State Row ID" and "State Name" in two different column headers.
- Map "StateRowID" in the first column.
![StateRowID]()
Step 13
- Map "StateName" in the second column.
![StateName]()
Step 14
- Select and delete the third column.
![delete column]()
Step 15
- Now the report design is ready.
![report design]()
Step 16
- Click on preview to check the report.
- Pass a parameter value.
![report preview]()
Step 17
- You can see the list of states for the country you passed in the parameter.
![states report]()