Solved

SSRS enable Report Parameter only when another Report Parameter is selected

Posted on 2014-02-11
5
2,106 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 13

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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 …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

839 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