SSRS optional parameters settings

Posted by Natasa Gavrilovic on Geeks with Blogs See other posts from Geeks with Blogs or by Natasa Gavrilovic
Published on Wed, 28 Mar 2012 08:32:48 GMT Indexed on 2012/04/02 11:31 UTC
Read the original article Hit count: 188

Filed under:

Recently I had to create couple SQL Server Reports (SSRS) with optional parameters built in. It took me a while to refresh memory how this can be done. It was very simple to create reports and processes behind, but connecting these two were are little bit challenging – stored procedure was tested and worked fine, but when the report was passing optional parameters it didn’t returned expected results. After tweaking SQL stored procedures and reports parameter options, the following approach turn to be the winning one.

1) Defining report parameters:

From Menu bar select ‘View’ and ‘Report Data’

Newly open window should have ‘Parameters’ folder display

Right click on this folder and select ‘Add new parameter...’

 

optionalParams_01

 

 

 

 

 

 

 

 

 



optionalParams_02

 

 

 

 



Default values need to be added from a query

optionalParams_03

 

 

 

 

 

 

 

 



A query values need to include ‘’ (empty string) – as highlighted

optionalParams_04

 

 

 

 

 

 

 

 


 

2) SQL stored procedure should have CASE statements inside WHERE

and it was the only way that a report was getting correct results back.

optionalParams_05

 

 

 

 



© Geeks with Blogs or respective owner