0
votes

I have SSRS report that has around 80+ columns. I have requirement where in dynamically hide\show columns in report based on user selection. I could able to do it by setting expression for "Visiblity" property and having report parameter thro' which columns to display can be choosen.

My problem is 2 points

  1. fox example if columns 2 and 4 to be hidden, then there is an empty column between 1 and 3 and 5 columns. How to avoid this

  2. When i export to PDF / Excel these spaces prevail.

Let me know your suggestions / help.

2

2 Answers

0
votes

You can create a query that pivots your data, so that instead of a return table like this:

  • ColumnName0, ColumnName1, ColumnName2
  • Value[0][0], Value[0][1], Value[0][2]
  • Value[1][0], Value[1][1], Value[1][2]

You could format it like this

  • ColumnName, Value0, Value2
  • ColumnName0, Value[0][0], Value[1][0]
  • ColumnName1, Value[0][1], Value[1][1]
  • ColumnName2, Value[0][2], Value[1][2]

And then your first column (ColumnName) would always be your title, and you could use it as your column group. You might have to use a dynamic query for this, but it would take care of both items 1 and 2 in your question.