SSRS: Relative URL Hyperlink

In SSRS 2008, I would like to create a relative path URL. In short, I have a subscription that outputs several thousand static HTML pages to a folder that is used as content for the website. I used to create full URLs to other pages of the site (actually) using the properties of the text field → Action → Go to URL. I would like to modify my code so that it returns the relative path of the target instead of the full URL. This will reduce the likelihood that someone will ultimately break the navigation by changing the site structure or folder structure. When I tried to do this work, the objects that were previously available for click were no longer there, but could be clicked. How do I make the SSRS hyperlink go to a relative URL instead of a full URL?

Here's what works:

="https://some.domain.com/some_page/" + Fields!Custom_Page_Name.Value.ToString() + ".html" 

Here what does not work:

 ="../" + Fields!Custom_Page_Name.Value.ToString() + ".html" ="/" + Fields!Custom_Page_Name.Value.ToString() + ".html" =Fields!Custom_Page_Name.Value.ToString() + ".html" ="..\" + Fields!Custom_Page_Name.Value.ToString() + ".html" ="\" + Fields!Custom_Page_Name.Value.ToString() + ".html" 
+4
source share
5 answers

If you look at the warning generated when you run the report in Visual Studio, you will get the answer:

[rsInvalidURLProtocol] The value "test.html Hyperlink Text Box Properties" textbox6 has an invalid schema. Report URLs can only use http: //, https: //, ftp: //, mailto: or news:

i.e. URLs must have one of these protocols, and since there is no way to write a relative URL when it starts with the protocol, which means that SSRS does not support relative URLs.

An alternative would be to set the base URL in a parameter, which would then be easily changed and would require your html pages to regenerate if it changes.

+4
source

Just read this Q and A and get the best solution for those who are looking. If you need a relative url just use javascript for example.

 ="javascript:void(window.navigate( '/mydirectory/reportcountry.aspx?CountryID=" + Fields!CountryID.Value.ToString() + "'))" 
+5
source
 ="javascript:void(window.open(document.URL.replace('CurrentReportName','NavigateToReportName'),'Window1','menubar=no,width=430,height=350,toolbar=no'));" 

I know this is an old post. it might help someone. Please note: I am using SSRS 2008

+3
source

Just use the global variable Globals!ReportServerUrl

So, "http://myservername/rs?/myreportname" becomes Globals!ReportServerUrl + "?/myreportname"

0
source

In Visual Studio 2013 with SQL Server data tools, you can access the property pages for a shortcut. This makes it possible to refer to another report (in the same project) and transfer any parameters as necessary:

Screenshot from property pages.

0
source

All Articles