Link to home
Start Free TrialLog in
Avatar of Abdul Khan
Abdul Khan

asked on

optional parameter based on another parameter in SSRS report

I am using following 2 parameters on my SSRS report:  

@status   ( Current or Closed)
@Fromdate and @Todate

My first query looks for                      status = Current without Date Range
My second Query looks for               Status = Closed with a date range.  

I would like to default null to the date range when a user selects Status = current,  and if they select Status = Closed then provide them an option to select a date range.
Can someone please help.  Thanks.
Avatar of irudyk
irudyk
Flag of Canada image

Parameters is SSRS are either displayed to the user or not. So, it's not possible is SSRS to have parameters appear after a user selects an option in another parameter.

In this case, you could consider changing the label of the @status parameter to read
 Current (to/from date n/a)
 Closed (to/from date req'd)

Then in your stored procedure check @status value to determine whether the @Fromdate and @Todate should be ignored (i.e. Current) or used (i.e. Closed)

Also, to avoid users having to select a @Fromdate and @Todate, set their default values to some standard value (e.g. prior year to date and today's date).

Another alternative is to create 2 reports. A Current report (would have no parameters necessary) and a Closed report that would have the @Fromdate and @Todate parameters.
Avatar of Abdul Khan
Abdul Khan

ASKER

Thanks @irudyk , I guess I will have to live with what I have.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.