Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS show/hide tablix column programmatically based on parameter in rdl file

I have a SSRS rdl file that contains a 3-column tablix table, I want to show and show any of the columns programmatically based on the rdl paramter.

I can achieve that by setting the Hidden property of a column to an expression:

=Parameters!ShowSecondColumn.Value

However, the problem is that when the middle column is hidden, the column space is still there. What I need is that the third column move and occupy the second column.

Any idea would be very much appreicated.

sss 2008 r2

like image 993
Pingpong Avatar asked Jul 25 '11 17:07

Pingpong


People also ask

How do you hide a column based on an SSRS expression?

To hide static columns in a table, matrix, or list. In Design view, select the table, matrix, or list to display the row and column handles. Right-click the column handle, and then click Column Visibility.


2 Answers

Thanks Kevin Fisher. As he pointed out, "column visibility" should be set rather than field visibility.

like image 129
Pingpong Avatar answered Sep 17 '22 16:09

Pingpong


Let’s say my report(SSRS 2005) have 5 columns. And I want to show/ hide columns based on a parameter(multi select with all 5 column names) selected by user. do as following

1)Create a parameter of type string (ColumnVisibility is name of my parameter) with desired column names in labels for the 5 columns and INT number(01,02,03,04,05) respectively in the values in “Available Values” section of the parameter wizard.

2) Then Go to column Properties on design . Go to “visibility” and paste following

=iif(instr(Join(Parameters!ColumnVisibility.Value,","),"01")>0,false,true)

3) repeat same for all the columns, by increasing the int value by 1..see following for example

2nd column -

=iif(instr(Join(Parameters!ColumnVisibility.Value,","),"02")>0,false,true)

3rd column

=iif(instr(Join(Parameters!ColumnVisibility.Value,","),"03")>0,false,true)

And so on.

for SSRS 2008, when you right click on the column you can see "Column Visibility" option. paste the code in "show or hide based on an expression" section for each column.

Hope this helps.

Arvind

like image 32
Arvind Avatar answered Sep 19 '22 16:09

Arvind