简体   繁体   中英

SSRS report — open detail report with parameters in URL with relative URL so it works correctly in regions (XML and javascript involved)

Per the questions below, in order to open an SSRS report in a new tab or new window, one has to use javascript and a URL.

Previous Question #1

Previous Question #2

The need is to have the detail report open in several regions, such as dev-region, int-region, and production (prod). The answers above would have absolute URL's, all different. Is it possible to do this with relative URL's? If so, what would the example syntax be, please?

NOTE: It may be assumed that the two SSRS reports (the parent or summary and the child or detail) are in the SAME folder. This should greatly simplify a relative URL-styntax.

Also, I was able to answer question below, the answer ALSO covers everything one needs to open an SSRS detail report in another window (Should work for ssrs-2008-r2 and above).

This would also help solve questions such as:

SSRS relative URL

To answer my own question (I had some of this information from a colleague, I had to develop some myself). This information is scattered all over the place, but for SSRS reports, I think that this is the only one-stop concise place that I know of:

<Hyperlink>="javascript:void(window.open('" &amp; Globals!ReportServerUrl &amp; "/Pages/ReportViewer.aspx?" &amp; Globals!ReportFolder &amp; "%2fMy+Report+Name" &amp;  chr(38) &amp;  "rs:Command=Render" &amp; chr(38) &amp;   "Input1=" &amp; Fields!GoesWithInput1.Value &amp; chr(38) &amp;  "Input2=" &amp; Fields!GoesWithInput2.Value  &amp; "'))"</Hyperlink>

NOTES:

  1. Above is horizontally very long
  2. "My Report Name" has spaces replaced by '+' character
  3. ABOVE is XML within rdl, if using the 'design' (action) in designer, you don't use the XML tags and would start with “=”
  4. Chr(38) is ASCII for "&" (ampersand) the & is a concat operator for the strings used within the javascript command. Thus "ampersand escape" is involved and done two ways.

  5. Note that this is a hodge-podge of Javascript and XML. Since URL's are involved, http is also important (often https these days).

  6. Finally, this is not TSQL-based and is not in the using the TSQL and the dataset. It is possible to form URL's that way, but this solution here doesn't do it that way. I tried, and the Globals didn't seem to be available, at least in the way I tried to use them in the TSQL within the in the XML of the rdl-file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM