简体   繁体   中英

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.)

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