views:

3702

answers:

5

I have a report in Reporting Services 2005, and I want to hide or show a single table column based upon a report parameter. Does anyone have any idea how to do that?

Thanks!

+2  A: 

Set the Visibility for the column to an expression which will return true or false. This property can be found on in the Visibility tab on a TextBox for example.

Click the radio option for Expression and then your expression might look like

=Parameters!ShowColumn.Value
JoshBerke
Thanks Josh, I am actually going to use the Hidden property (a sub property of visibility [at least in vs 2005]) for the column.
Dan Appleyard
+1  A: 

As I recall, you can't do this.

Or rather, it doesn't work as intended.

You end up with a blank column.

One workaround would be to conditionally remove the column from the dataset

Here is a hacky workaround (not tested by me) http://www.theruntime.com/blogs/thomasswilliams/archive/2008/09/29/hiding-and-showing-columns-based-on-a-parameter-in-reporting.aspx

adolf garlic
+1  A: 

Use the visibility property of the column. This worked for me.

=iif(Parameters!ParameterName.Value = "TextValueOfTheParameter",False,True)

Antione Rockamora
A: 

Tip: If the expression returns "False" then the column or row will be visible. If the expression returns "True", the expression will be hidden. This tricked me at first.

Ben
A: 

For some of my reports I've set the Visibility (Specifically the Hidden property) for the column to:

=IsNothing(Fields!Site.Value)

Note that this only works if the relevant field can be null in the underlying dataset, otherwise you will see the blank column.

Gary Stacey