Thursday, September 1, 2011

SSRS: Using &ReportName In SharePoint Mode vs Native Mode

This blog highlights the different values (for the same report) returned in the two modes in which SSRS can be run; Integrated into a SharePoint Farm, and in Native (or stand-alone) Mode.

For the purposes of testing I am running Report Builder 3 against 2008R2 SP1 reporting servers. The version of SharePoint I'm using to integrate with is 2007 (with SP2). To browse the website I'm using Internet Explorer 9.

UPDATE (from Microsoft): The lowercasing behaviour (documented below) is a "known bug" (108596) which will be resolved in a "future release". Appending the ".rdl" extension is a feature of SharePoint and as such is "as intended" behaviour. Bugs are fixed based on the number of users affected so if you want it fixed you need to raise it with Microsoft.

Writing The Test Report
Let's start with a fairly simple report;
Report Builder 3: New Report (Using Wizard)
This report is basically the "Blank Report" as created by the wizard when you first start Report Builder 3 (without specifying a starting report).

Right-click on the "Click to add title" at the top of the screen;
Report Builder 3: Expression Dialog (using Globals!ReportName)
Choose "Globals!ReportName" as your expression (under the "Built-in Fields" category on the left). Click OK;
Report Builder 3: Showing &ReportName as Report Title
You'll see that the title of the report is now set to the Report Name. Click on "Run" (left on the ribbon);
Report Builder 3: Showing Report GUID

This is your reports GUID. As you haven't saved the report yet it doesn't have a formal name so the expression evaluates to the GUID.

Saving The Report To Reporting ServersSave the Report to a native (stand-alone) server using the name "ReportName Test Report" and click refresh;
Report Builder 3: Native-Mode Report Title
Save the Report to SharePoint-Integrated server using the same name and click refresh;
Report Builder 3: SharePoint Integrated-Mode Report Title
You notice that ".rdl" (the file extension) has been appended in SharePoint integrated mode.

Both of these tests were running the report in "Report Builder" - this is usually a pretty good indicator of how the report will look in live but it's important to test the report in a web browser as well.

Looking at the native mode report in Internet Explorer (I'm using IE9) gives you;
Native-Mode Report in IE9
Looking at the same report in SharePoint integrated mode;
SharePoint Integrated-Mode Report in IE9
Exactly what you'd expect. Now close Report Builder, open the native-mode report and then save it to the SharePoint server (adding a 1 suffix so we can tell it's different). Close down Report Builder (so we can be sure we're not carrying across any settings) and re-edit the "ReportName Test Report 1" file.

Preview the report in Report Builder;
Report Builder 3: Migrated Report
Exactly what we'd expect. Now view the report in IE;
Migrated Report in IE
The ReportName has now been converted to lowercase.

Result Summary for ReportName "ReportName Test Report";
Non-Integrated Mode

  • &ReportName remains "ReportName Test Report" in all circumstances
Integrated (SharePoint) Mode
  • &ReportName has ".rdl" added as a suffix in all circumstances
  • If the report has been migrated from Non-Integrated Mode @ReportName is converted to lowercase when viewing in a browser only (Report Builder is unaffected)

No comments: