简体   繁体   中英

SSRS Grey out Parameter based on result from other Parameter

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

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.

在此输入图像描述

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM