SSRS Grey out Parameter based on result from other Parameter

Zakerias picture Zakerias · May 22, 2013 · Viewed 23.1k times · Source

I wondered if it was possible to grey out a parameter based on the the result from another parameter? In this case, if specify date is set to 'No' then Start Date and End Date should be greyed out.

SSRS

As you can see from the screenshot this hasn't happened, despite setting Specify Date to either Yes or No - start date and end date will expect a value (unless you tick the NULL value). The report will run fine if both the NULL boxes are ticked beside both the start and end dates - but if they are automatically greyed out based on 'No' it will make the process a lot easier for users.

So in short, if 'No' dates greyed out, if 'Yes' display. Is this possible? and if so how?

Many thanks in advance for any replies

Answer

StevenWhite picture StevenWhite · May 22, 2013

Within the confines of what's built-in, you can use this method:

  1. Create a dataset that is based on your SpecifyDate parameter.

    if @SpecifyDates = 'No' select null as Date else select cast('1/1/2012' as datetime) as Date

  2. Set the default values for your dates to be based on this dataset.

enter image description here

When you choose "No" for specify dates, the dates will be set to Null, greyed out, and not required to run the report. When you select "Yes" it will put in the default date that you set in the query. Of course you can customize that.