6/02/2012

MS SSRS: Jump to the Report Manager´s folder from a report

Case 1: I want to have link text “Go to Documents” in my report and clicking it takes me to ”Documents” folder in the Report Manager (ReportServer1).
> I add a Text Box to the report and type "Go to Documents" to it. Then I open the text box properties > Action. I choose "Go to URL" and click fx-button. See pic. below. 

I type the target folder URL to the expression box:

=”http://ReportServer1/Reports/Pages/Folder.aspx?ItemPath=%2fDocuments&ViewMode=List”                                

And it works.

Case 2: I want to have link text in my report and clicking it takes me to ”Documents” folder in the Report Manager (Report Server1). I can’t have Report Server name in the link because same report and it’s link has to work in several different report servers.
> There's a Built-in fields collection the Globals in the Reporting Services and one of the variables is ReportServerUrl. It returns the URL of the report server on which the report is being run. I use that:
=Globals!ReportServerUrl + "/Reports/Pages/Folder.aspx?ItemPath=%2fDocuments&ViewMode=List"                                      
As a result, it jumps to Report Server database directory:

And when I look at the address:
http://ReportServer1/ReportServer/Reports/Pages/Folder.aspx?ItemPath=%2fDocuments&ViewMode=List
I see ReportServer in the path because ReportServerUrl variable returns “http://servername/ReportServer”.

> So I have to revise this expression to have right path. Let’s take off that part using REPLACE function:

=Replace(Globals!ReportServerUrl + "/Reports/Pages/Folder.aspx?ItemPath=%2fDocuments&ViewMode=List", "ReportServer", "")

And now the link text works as I wanted.