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
 General SQL Server Forums
 New to SQL Server Programming
 SSRS Parameter help

Author  Topic 

Briceston
Yak Posting Veteran

54 Posts

Posted - 2013-10-29 : 12:53:29
Hi,

I have a SSRS report with four parameters,and I want to be able to enter information for two of the parameters and run the report opposed to all four of them. However, when I select allow blanks and only select the parameters that I want to run the report by, the report come back blank

Essentially, I want to be able to the run report by different parameters without having to enter information for all parameters at the same time.

What is the correct way of going about this?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-29 : 13:56:39
you need write logic in your backend query to bypass filtering in case parameter value passed is blank.
ie WHERE clause will look like


..
WHERE(Field1 = @Param1 OR @Param1 = '')
AND (Field2 = @Param2 OR @Param2 = '')
AND (Field3 = @Param3 OR @Param3 = '')
AND (Field4 = @Param4 OR @Param4 = '')


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Briceston
Yak Posting Veteran

54 Posts

Posted - 2013-10-29 : 15:02:45
Thanks a lot! Your insight worked great once I made the neccessary adjustments in my logic. Once deployed I assume it should still work correctly as it now?

Thanks again for the help.

quote:
Originally posted by visakh16

you need write logic in your backend query to bypass filtering in case parameter value passed is blank.
ie WHERE clause will look like


..
WHERE(Field1 = @Param1 OR @Param1 = '')
AND (Field2 = @Param2 OR @Param2 = '')
AND (Field3 = @Param3 OR @Param3 = '')
AND (Field4 = @Param4 OR @Param4 = '')


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs


Go to Top of Page
   

- Advertisement -