Shrink SSRS HTML5 rendered document size for gmail

I have a C# app that generates SSRS Reports which are either attached to an email or added to the body of the message if the rendering format is HTML. Emails are looking great and then someone opens it in the gmail web client and sees a nasty [message clipped] message, turn outs gmail clips the contents of an email body if it is bigger than 105kb.

After reviewing some documentation, https://docs.microsoft.com/en-us/sql/reporting-services/report-builder/rendering-to-html-report-builder-and-ssrs, I noticed that the rendering engine will render both a full HTML and fragmented HTML document. Wouldn’t you know it the fragmented version is much smaller, all styling is inline and not so bloated with javascript.

I render my reports using the ReportExecutionService class which contains a method called Render; Render accepts a DeviceInfo parameter that when set to null gives you the full HTML document, however if you set the value of DeviceInfo to   @"<DeviceInfo><StreamRoot>/</StreamRoot><HTMLFragment>True</HTMLFragment></DeviceInfo>" you get a fragmented small html file that renders in gmail perfectly.

The code snippet below provides a simple inline if statement to set the value

string deviceInfo = format == "HTML5" ? @"<DeviceInfo><StreamRoot>/</StreamRoot><HTMLFragment>True</HTMLFragment></DeviceInfo>" : null; 

Ragged Parent Child Hierarchies SSRS

Awesome Post explaining how to best setup an SSAS Parent Child hierarchy in SSRS,

http://blog.davyknuysen.be/2010/04/16/parent-child-hierarchies-in-reporting-services/

However if you have a ragged hierarchy you wind up with repetitive members, to address this issue you can use the following visibility expression in the Row Group properties

In the ‘Row Groups’ Pane click the down arrow on the grouping and select group properties.

  • Select Visibility
  • Select Show or Hide Based on Expression
  • insert the following expression ‘=iif(Instr(fields!fieldName.UniqueName, “DATAMEMBER”), true, false)

 

SSRS 2008R2 SharePoint Integrated Report Viewer URL Parameters

Found this handy post outlining the the correct format for creating a URL to render a SSRS report hosted in SharePoint integrated mode.

http://blogs.msdn.com/b/prash/archive/2009/01/21/passing-url-report-parameters-to-reports-in-sharepoint-document-library-in-ssrs-2008.aspx

Very handy for creating Go To URL Actions, speaking of which if you want to open your report in a new window check out the post below.

http://www.bidn.com/blogs/BrianKnight/ssis/972/ssrs-action-to-open-a-url-in-a-new-window

 

Auto Refresh SSRS Reports in SharePoint 2010 Part II

So it turns out that refreshing all reports on a dashboard may not provide you with the desired user experience; Content Editor to the rescue.

Add a Content Editor Control web part to your Web Page

First find the ID of the Refresh Button on on the SSRS webpart tool bar of the report to be refreshed; I used IE Developer tools to find the ID.

Once you have the ID,  add the following script to the content Editor control and every 60 seconds the report gets refreshed.

<script type=”text/javascript”>

function refreshReport()
{
var btn = document.getElementById(“ID Goes Here“);
btn.click();
}

setInterval(‘refreshReport()’ ,60000);

</script>

Auto Refresh SSRS Reports in SharePoint 2010

Thank you Brian Keay for your post

http://briankeaybi.wordpress.com/2011/02/21/auto-refresh-ssrs-in-sharepoint-2010/

If you happened to find this post and were pulling your hair head like I was when you copied and pasted Brian’s code snippet and it did not work, try deleting the single and double quotations and retyping them in, stupid fonts. If you did not find Brian’s post I have included his code snippet below

<script type=”text/javascript”>
// The time out value is set to be 60,000 milli-seconds (or 60 seconds)
setTimeout(‘document.location=document.location’ ,60000);
</script>

Couple additional things to note.

1. you can save this script into a text file, store in a document library and point your content editor -> content link to the txt file

2. you can also type the script directly into the Content Editor HTML Editor, click in the content editor in edit page mode. You will see the Content Editor Ribbons. On the Format Text Ribbon there is a Markup section where you will find an option to edit HTML, type the script there.

Wait 60 seconds and voila, refresh

A giant thanks again to Brian

Performance Point SSRS Reports

The other day a client needed a utilize the same SSRS Report in 4 places on the same Performance Point Dashboard, pretty simple right, yup create 4 PPS SSRS reports with the correct default parameters and drop them on a dashboard. Well it turns out that when the reports refresh themselves the default parameters do not get reused and the parameter used for reports gets carried forward from the report that was previously refresh, Arg!

So the solution was to create a SharePoint page with four report viewer web parts. One thing to note is that every time you edit a reportviewer web part the tool bar options all get re checked, even if you have painstaking unchecked them previously.