Blog

April 16, 2015
|

Shor or Hide a SSRS report column/item based on render type

SSRS provides a huge amount of rendering types. So far so good, but if you want to render the same report definition as HTML and let’s say as a PDF file you’ll maybe have a goal conflict. HTML does not care about page sizes and breaks, documents like PDF’s do. If your report has too many columns to put them on one page there may be some different approches:

  • Reduce font sizes
    (until it’s impossible to read)
  • Break up one line into multiple lines
    (which could end up in an information chaos)
  • Hide columns
    (which is maybe not possible because EVERYTHING is important)

Approach 1 and 2 are easy and not worth to write about. The “hide column” approach is a bit more interesting.

Simple hide (just for testing)

Select the header of the column you want to hide, right-click and select “Column Visibility…”. In the dialog that pops up, select “Hide”, render your report and you’ll notice that your column disappeard.

hidecol01
hidecol02

Hide conditional

After that initial check, you could switch over to “Show or hide based on an expression” where you could define your own expression. One common approach is to hide data in non-interactive (see table below) render types. There’s a global variable called Globals!RenderFormat.IsInteractive for this purpose. Use this as expression:

 

 

 

If this isn’t detailed enough, use the global variable Globals!RenderFormat.Name to determine the visibility through the name of the rendering type:

 

 

 

Here’s a complete list describing which render types are interactive:

Renderer RenderFormat.Name RenderFormat.IsInteractive
SSDT Preview /
Report Manager
RPL True
HTML4.0 HTML4.0 True
XML file with report data XML False
CSV (comma delimited) CSV False
TIFF file /
SSDT Preview > Print-Button
IMAGE False
PDF PDF False
MHTML (web archive) MHTML True
Excel EXCEL False
Word WORD False
Tags:


1 Comment


Would you like to share your thoughts?

Would you like to share your thoughts?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.