Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Pass in parameter on report

Author  Topic 

jamie_pattison
Yak Posting Veteran

65 Posts

Posted - 2008-09-02 : 11:33:42
I created a SQL Query as below

SELECT

Name,
Address,
ID

WHERE

(ID = @ID)

FROM

Customers

I created a dataset in my report and added this query. It executed fine but without results which was fine as i dont have an ID specified to pass in.

I created a second dataset (called IDDS) in my report and query called ID (the query returned the results i expected)

The query is:

SELECT
ID

FROM
Customers

Group By
ID

Under the layout tab for the report i select Report > Report Parameters and type the name as ID.

Under available values
select the dataset: IDDS
Value Field: ID
Label FIeld: ID

Ran the report and i see my parameter from the dataset IDDS. When i select a value it doesnt return any results.

I believe that is because ive not tied the parameter values (from IDDS) to the main query from the first dataset so not sure what i need to do. Could anyone advise?

Thanks

harlingtonthewizard
Constraint Violating Yak Guru

352 Posts

Posted - 2008-09-02 : 20:28:27
Have you set the details up from the top menu item Report > Report Paramters. You can use your second query to populate the available and default values and select multi-value if you like. Also try this for your whereclause:
WHERE (yourtablename.yourfieldname IN (@yourvariablename))
Go to Top of Page
   

- Advertisement -