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!
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!
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
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
Use the visibility property of the column. This worked for me.
=iif(Parameters!ParameterName.Value = "TextValueOfTheParameter",False,True)
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.
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.