Adding a parameter for an external datasource query
This recipe will extend the previous recipe to add a parameter that will influence the data retrieved through the SQL query.
Getting Ready
This recipe requires that you have the Adventure Works database installed and you have ready access to the SQL server. This is a continuation of the report developed in the Building a report through an external datasource recipe in this chapter.
How to do it…
Open the project and the report associated with the project.
Select the dataset and open the query editor window to modify the query as shown here:
SELECT NationalIDNumber, LoginID, JobTitle, BirthDate, MaritalStatus, Gender, HireDate, VacationHours, SickLeaveHours FROM HumanResources.Employee WHERE (NationalIDNumber LIKE @Id) // @ID will be treated as a variable
Click OK to see the parameter reflected in the Parameters node in the dataset and report parameters in the report model. A new popup will show up asking for the parameter; you can key in a valid...