Creating Links to Other Reports

July 28, 2009

When designing a Reporting Services (2005 or 2008) report and you want to have a link to another report, there is an option under the Text Box Properties for “Go to report”, but when the link is executed, the resulting browser page is a bit hard to figure out how to get back to the parent report.

A better solution is the other Action item  “Go to URL”, With it you can set up an expression for the url that will be executed. While you can hard-code the entire URL, it is best to use parameters and global fields to make the coding ‘maintenance free’ when moving from TEST server to Production. An example of a URL expression is shown below:

 

= “javascript:void(window.open(‘” +

Globals!ReportServerUrl + “?” + Globals!ReportFolder +

“%2f<My Report Name here>&ClientReportID=” + Cstr(Fields!ClientReportID.Value)

+ “‘,’_blank’))”

 

The string is explained line by line:

  • First and last line make it so the link is executed in a popup window. Basically, it ‘wraps’ the string with a java command that opens a new browser window.
  • Second line: Uses two Global Built-in Fields for server and folder path. Note the inclusion of the literal “?” between the two.
  • Third Line: Start with the literal “%2f” followed by your hard-coded linked report name. Add parameters as needed.

 

NOTES:

  1. This link method cannot be tested in your Visual Studio Development environment because the two Global fields are out of context and are empty. Test it once it gets deployed to the TEST server. After all, that’s what it’s for!
  2. Use the Globals.ReportFolder field only if the linked report will be deployed to the same location (virtual folder) as the source report. If not, you may need to hard-code the folder path and hope for the best when it is deployed.
  3. Replace the spaces in literal names with plus signs and slash characters with “%2f”:  “Extranet+Reports%2fMy+Report+Name”
  4. There is a whole host of other command that can be concatenated to the string, like for hiding the parameter selection section, jumping to a Document Map entry, etc.