Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SSRS enable Report Parameter only when another Report Parameter is selected

Posted on 2014-02-11
5
Medium Priority
?
2,471 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 400 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 400 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 300 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 66

Accepted Solution

by:
Jim Horn earned 300 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

916 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