views:

33

answers:

2

Hi I've been stumped by this for a while. I need to build a report in SSRS 2005 where a user can select the columns he wants to see from a parameter. So basically the other columns need to be hidden. I can get this to work on 2 coulumns only as the minute I add more and make the Parameter a multivalue parameter nothing works.

A: 

If you have 5 @Parameters, of which any could be NULL or Empty, try using an IIF in the Visibility of the Column.

 =IIF(Parameters!YourParameter.Value ="",False,True)

or The SWITCH function:

=Switch(Parameters!Param1.Value = 1, True, Parameters!Param2.Value = 2, False, Parameters!Param3.Value = "", False)

I've variations on this to hide things from users if a particular @Parameter was not passed in.

D.S.
I dont think thats quite what I'm looking for. For example I have 4 parameters : Employees, Region, Sales, Details.
Fabrizio
Sorry tried to get to a new line... lets carry on. So i got the 4 parameters and 4 columns called the same. Users can select any combination of the parameters. Now once you've selected the parameters you want to see i need to set the column visability based on this. The issue is when you select multiple values the report wont even generate and gives an error.
Fabrizio
Don't use the "Multivalue" setting. You have 4 Parameters. You should get 4 "Textboxes" to fill in the values when the report is run. If the value for a particular parameter is empty/blank/null set the visibility for that column to FALSE. The multivalue setting is used if you have single parameter which takes in multiple values.
D.S.
A: 

Hi I got the answer to anyone that needs it it's actuall pretty simple follow the link and there's a really good explanation on how to do this. NB*** Where it said paste the code in a function, just right click in the yellow screen part in the layout section. Select properties and select the code tab and paste the function there exactly as is.

Heres the link http://theruntime.com/blogs/thomasswilliams/archive/2008/09/29/hiding-and-showing-columns-based-on-a-parameter-in-reporting.aspx

Fabrizio
What happens when they pass in a parameter and then set the column visibility to FALSE? If you base the visibility on the Parameters passed (Employee, Region Sales, Details) you don't have to worry about them messing up the report. If they don't put in a value for a @Details param, they don't see the column.
D.S.