开发者

Enable/Disable SSRS parameters

I am pretty new to SSRS and I tried searching for the answer before posting here. I want to enable a parameter(dropdown list) when another param (also from a dropdown list) is selected. I only see a visible/hidden property on the param but nothing that would enable/disable it.开发者_开发技巧

Would be great if someone could please post an example. Thanks a lot.


In the Report Manager interface, you can't directly enable or disable a parameter with another parameter (or any code within the report.)

But you can work around this by making the options in the second parameter dynamic, based on the first parameter.

For example, in a calorie report, your first parameter might have a hard coded list of options:

First Parameter: Dessert Choice:

  • Sundae
  • Cake
  • Ice Cream Cone

A data set would use that parameter:

IF @DessertChoice = 'Sundae'
Begin
   Select 'Hot Fudge' As Subtype
   Union all
   Select 'Caramel'
END
ELSE IF @DessertChoice = 'Cake'
   BEGIN
      Select 'Chocolate' As Subtype
      Union all
      Select 'Angel Food'
   END
ELSE
   Select 'No Options' as Subtype

Use this intermediate data set as the available parameters for the second parameter.

You can also use a data set to set the default value for the second parameter, so the user does not need to select a parameter if there is only one option.

(Code above was typed into this browser without any testing, hopefully it's accurate enough for you to get the idea.)


SSRS 2008 R2: How to: Add Cascading Parameters to a Report

SSRS 2016+: Add Cascading Parameters to a Report (Report Builder and SSRS)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜