Solved

SSRS enable Report Parameter only when another Report Parameter is selected

Posted on 2014-02-11
5
1,988 Views
1 Endorsement
Last Modified: 2014-02-25
Hello,

I have two Report Parameters that are not cascaded in my SSRS Report.

The first parameter is a Year.

The second parameter is a drop-down with values "Month" and "Quarter" - to basically ask the user if they want the Monthly or Quarterly data.

I want the second parameter to be enabled only if the user selects a value from the first parameter.

Since the stored procedure invoked from the report expects value from both those parameters, I'm trying to prevent the error which would occur incase the user just selects a value for second parameter but not for the first parameter.

Question 1:
Is there a option to disable the 2nd report parameter until user selects a value for the 1st Report Parameter?

Question 2:
I tried the following approach and it works, but I'm not sure if this approach would cause any side-effects.
Can someone let me know if this approach is appropriate?


I have 2 available values set for the 2nd Report parameter.
Label: Month    Value: Month
Label: Quarter  Value: Quarter

Open in new window


Instead of the value Month, I'm using the expression:
=IIf((Not(IsNothing(Parameters!Year.Value))),"Month","")

Open in new window


Is this appropriate?
1
Comment
Question by:sath350163
5 Comments
 
LVL 37

Assisted Solution

by:ValentinoV
ValentinoV earned 200 total points
ID: 39849496
Is there a option to disable the 2nd report parameter until user selects a value for the 1st Report Parameter?

Not really.  The only functionality that simulates this is cascading parameters.

But... why don't you just specify defaults for both parameters and disallow NULL/blank?  In that case you would avoid the situation for which you're trying to find a solution...
0
 
LVL 37

Assisted Solution

by:ValentinoV
ValentinoV earned 200 total points
ID: 39849502
Since the stored procedure invoked from the report expects value from both those parameters, I'm trying to prevent the error which would occur incase the user just selects a value for second parameter but not for the first parameter.

As long as you don't have the Allow blank value or Allow null value checkboxes activated the report will always require both parameters to have a value before the call to your main stored proc is made, so what you've described should normally never occur.
0
 

Author Comment

by:sath350163
ID: 39849533
Thank you for the response.

- Cascading would not work in my case, as those two Report Parameters are not dependent.

The 1st parameter year has the last 5 years in the drop-down.
The 2nd parameter has 2 static values "Month" and "Quarter", which is not dependent on the 1st Report Parameter Year.


- My requirement does not allow default values to be set for the Report Parameters.
I want to even avoid the Parameter error that pops up when I try to preview my report by selecting a value for the 2nd parameter while not selecting a value for the 1st parameter.



Thanks!
0
 
LVL 12

Assisted Solution

by:Koen Van Wielink
Koen Van Wielink earned 150 total points
ID: 39849545
What if you fill in a default value for the first parameter? Like the current year? That way, the user cannot forget to fill it and you won't get an error either.
0
 
LVL 65

Accepted Solution

by:
Jim Horn earned 150 total points
ID: 39849967
>I want the second parameter to be enabled only if the user selects a value from the first parameter.

As VV stated above it can't be done, but one workaround would be to rewrite the SP that feeds the dropdown in the second query, so that if Year is passed, the only allowable value is <ALL>, instead of 'Month' and 'Quarter'.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now