13
votes

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

2

2 Answers

13
votes

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.

1
votes

There's not too much customization you can do with the SSRS parameter widgets.

What I have seen and done in the past to achieve this type of functionality was to code our own html/js forms and have them submit the parameters to the report. This does result in having to maintain extra code, but when it is required and not supported, you have to go outside the box.

That being said, I am curious to see what anyone else would suggest.