Chris Webb's BI Blog

Analysis Services, MDX, PowerPivot, DAX and anything BI-related

Implementing IE8 Web Slices in an SSRS Report

with 6 comments

One of the new features that caught my eye in Internet Explorer 8 when it came out was Web Slices – the ability for a web developer to carve up a page into snippets that a user can then subscribe to. There’s a brief overview of what they are here:
http://www.microsoft.com/windows/internet-explorer/features/easier.aspx
and a really good guide to implementing them from Nick Belhomme here:
http://blog.nickbelhomme.com/web/webslice-for-ie8-tutorial_84

Being the BI geek that I am, my first thought was to see whether they could be used with Reporting Services reports. After all, wouldn’t it be cool if you could subscribe to a table in an SSRS report, or even better a cell within a table, and get notified when that value changed rather than have to keep pinging the report yourself? Of course it would! Here’s how to do it…

The challenge with implementing web slices is to get SSRS to generate the necessary html when it renders your report. I first looked at using the new rich formatting functionality that’s available in SSRS 2008 that Teo Lachev describes here, but it turns out that you can’t use this to create Web Slices because SSRS doesn’t support the necessary attributes (see here for details – at least I assume this is why, because I couldn’t get it to work). The only way I could get it to work was to render the report as XML and then use an XSLT file to give me complete control over the HTML that SSRS generates. I won’t go into too much detail about how this works; once again, Teo has an excellent explanation in his book “Applied Microsoft SQL Server 2008 Reporting Services” (reviewed here – it’s an excellent book) on pages 263-265. To be honest this isn’t a satisfying approach for me because it involves a lot more effort to get the report looking the way you want, and of course you have to have control over how the report is rendered. However, it still makes for a fun proof-of-concept :-)

The first thing I did was create a simple SSRS report in BIDS that brought back values for Internet Sales broken down by country:

image

I then rendered the report to XML, took a look at the XML generated, and created a simple XSLT file that would generate a HTML report from that XML. I then added the XSLT file to my project and associated my report with it using the report object’s DataTransform property, so that it was always used when the report was rendered to XML. I was then able to deploy the project and, by using URL access to the report get it to render to XML and get the result treated as html, was able to see the following in IE8:

IE8Webslices

Here’s an example SSRS URL that does this:
http://myserver/reportserver?/Webslices/WebsliceDemo&rs:Command=Render
&rs:Format=XML&rc:MIMEType=text/html&rc:FileExtension=htm

Then I went back to BIDS and altered the XSLT file to add the necessary tags for a Web Slice around the main table. When I went back to IE and reopened the report after deployment I could see two new things. First, the Web Slice button appeared in the IE toolbar:

webslicetoolbar

And when I moved the mouse over the table in the report, it was highlighted with a green box as a Web Slice:

webslicehighlight

I could then click on either to subscribe to the Web Slice and have it added to my favourites. This then meant I could see the contents of the table in my Favourites bar whenever I wanted:

websliceshow

And whenever the data changes (you can control how often IE polls the original web page in the Web Slice’s properties, and also in the definition of the Web Slice itself) the text in the Favourites bar turns bold:

image

So there you are. Even with the limitations that having to render to XML imposes I can think of a few useful applications of this approach… maybe I’ll test them out in a future blog entry. Let me know if you have any ideas!

One last thing: I think it would great (and involve relatively little dev work) if SSRS supported the creation of Web Slices out of the box. If you agree, please vote:
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=443857

You can download my proof-of-concept SSRS project here:

http://cid-7b84b0f2c239489a.skydrive.live.com/embedrowdetail.aspx/Public/Webslices.zip

Written by Chris Webb

September 4, 2009 at 1:59 pm

Posted in Reporting Services

6 Responses

Subscribe to comments with RSS.

  1. Brilliant idea. Got a 5 on Connect from me. This surely wouldn\’t be difficult to implement either!!

    Jamie

    September 4, 2009 at 3:27 pm

  2. This really is a great one!And yes, brilliant demos could be based on this… :-)

    Markus

    September 4, 2009 at 6:04 pm

  3. That is pretty slick. I will put my two cents in on connect as well.

    Garth

    September 5, 2009 at 12:19 am

  4. Great job Chris!!!

    Francesco

    September 7, 2009 at 9:16 am

  5. Not only webslices are a way to show report data, windows gadets are also a possibility. I have made one for my company, it shows your current planning.

    Ian

    September 28, 2009 at 11:29 am

  6. Sorry Chris, but you are not right. You have advised to use DataTransform element in rdl file. As a result, you lost functionality to export report in native XML. Using that command destroys the other tasks based on XML format. For example, have a look at my article about report unit testing: http://andrew-butenko.spaces.live.com/blog/cns!E520F2283E87319C!186.entry . It is based on XML rendering. Instead of using imperative command DataTransform you have to use declarative one in href. It must be like &rc:DataTransform=myStylesForTransform.xsl. Unfortunately RS 2008 does not support this functionality yet.

    Andrew

    October 6, 2009 at 5:52 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 2,868 other followers

%d bloggers like this: