8
votes

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

2
Can you confirm that you're setting the actual "column visibility", and not just the visibility of the field within the column? In my experience, when the column visibility is set to hidden, any columns right of the hidden column will occupy the space of the hidden column.Kevin Fisher
@Kevin Fisher thank you. It works. I was setting the field, rather than "column visibility". Thanks!Pingpong

2 Answers

5
votes

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

1
votes

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