Redacting Data in SSRS 2012 When Printing or Exporting

In the age of paying for the weight of your recycling trash or kids trying to convince the Federal Government to change the font on all documents to save ink, I thought it was my time to offer up a solution that could save you and your company millions of dollars annually. Ok, maybe that is a little ambitious but read on!

With the desire to protect data as well as control printing of documents there is a very underutilized functionality in Microsoft SQL Reporting Services (SSRS) that actually allows you to control what gets ‘printed’ based on the rendering format. Once you get the hang of this you can use your imagination on the benefits. You could use it to redact information once it is printed or you could eliminate a graph or change the fonts based on rendering type.

I am going to take this scenario and show you how you can do it in SSRS.

SCENARIO: I have a report that when I view it on the screen I want to see the Number but when I print it I want to redact the Number so if the document falls into the wrong hands everything is fine. (Although that never happens)

Figure 1: Your current report layout

Figure1
(Figure 1)

 Step 1: Right Click on field and select Expression.

Figure2(Figure 2)

Step2: In the expression add this.

=iif(Globals!RenderFormat.IsInteractive, Fields!Number.Value, "XXXXXX")

Step 3: Completed.

When you run this on the screen you will see the full Number.Value (Figure 3) but when you run print this or export this you will see the following instead. (Figure 4)

Figure3(Figure 3)

Figure4(Figure 4)

This is not limited to just data. You could do this for images, colors, fonts, etc.

I have even seen people conditionally set titles, page numbers, etc so that when they export to excel it does not have the titles and other no important data. In which case you would use something like this.

=IIF(Globals!RenderFormat.Name = "EXCEL", True, False)

If you use something like this (above) you need to make sure you use the full name and case sensitive. You can find them here.

Looking for quality web hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , | Posted under ASP .NET 4.0, Programming/Coding | RSS 2.0

Author Spotlight

David Bauernschmidt

David Bauernschmidt

I live in the historical triangle of Virginia where I am married with two daughters. I have spent over 13 years working for a Fortune 500 company in the computer area. I started in VB 6.0 and by the time I ended my employment I was supervising a development team where we built many web applications. When my first daughter was born I wanted to spend more time with her so I left and became a programmer analyst for local government as well as launch my own company. Since then I have grown James River Webs into a profitable web design and application company helping small businesses create a big presence on the internet. As an employee I have created web application used by citizens and other companies. I enjoy fly fishing, and spending time with my family. I also enjoy learning new approaches and development tools when it comes to developing applications.

Leave a Reply

Your email address will not be published. Required fields are marked *


2 + 8 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>