![]() |
|
|
|
By: Rob Fisch | Read Comments (11) | Print Rob has worked with SQL Server since version 6.5 as a dba, developer, report writer and data warehouse designer. Related Tips: More |
|
Solution
Use a little javascript with a customized URL in the "Jump to URL" option of the Navigation tab.
Non-parameterized Solution
To get started, let's pop up a simple non parameterized report. Follow these instructions:
Note: The link will not work from the designer environment. You must deploy the report (hopefully to a test area) to try the link.
See screenshots below.


That's the easy part, ready for a more dynamic approach?
Parameterized Solution
Now, let's say you want to pass a variable to the drill through report. Let's also assume you have a field called ProductCode. Normally, you might hard code that like this:
http://servername/reportserver?%2fpathto%2freport&rs:Command=Render&ProductCode=123
In this case, you want to pass variables dynamically, using an available value from the source dataset.
You can think of it like this:
http://servername/reportserver?%2fpathto%2freport&rs:Command=Render&ProductCode=Fields!ProductCode.Value
The exact syntax in the "Jump to URL" (Fx) expression window will be:
--------------------------------------------------------------------------------
="javascript:void(window.open('http://servername/reportserver?%2fpathto%2freport&rs:Command=Render&ProductCode="+Fields!ProductCode.Value+"'))"
--------------------------------------------------------------------------------
Note - To avoid confusion between double and single quotes, double quotes are in red above.
Notice, that the static portion of the URL is delimited within double quotes.
Next Steps
| Share: | Share | Tweet |
|
![]() |
![]() |
Free SQL Server Learning |
| Thursday, May 01, 2008 - 1:49:37 PM - AceReports | Read The Tip |
|
I am so close to getting this to work for me -- but the child report won't acknowledge the parameter and insists on prompting me. Any ideas? thanks a million for posting it---it's a much better way of drilling through.... |
|
| Wednesday, June 24, 2009 - 8:22:11 AM - Sandi | Read The Tip |
|
I was wondering if you can help me out on this issue. I was able to pass a report parameter to the url and get the new browser window to open correctly, but when I pass a field to url I am unable to capture that specific value to pass to the subreport. ="BLOCKED SCRIPTvoid(window.open('" & Parameters!ServerAddress.Value & "?" & Parameters!ReportPath.Value & "&rs:Command=Render¶meter1=" & Parameters!parameter1.Value & "&Field1=" & Fields!Field1.Value & "','_blank'))" I was also successful in passing the value from the first value in the dataset and the report opened a new window and rendered correctly For example using: "First(Fields!Field1.Value, "DataSet1")" in place of the highlight string above. The problem is that I have a list of values returned in the dataset and I want to pass the specific Field1 value that the user selects for the subreport. Do you know why I am unable to pass the specific field value? Thanks, Sandi |
|
| Tuesday, August 24, 2010 - 2:27:59 PM - Reda Sheinberg | Read The Tip |
|
I wonder if you can help me with how to handle special characters in a parameter value? ="javascript:void(window.open('http://eagnmnsg4cd/ReportServer/Pages/ReportViewer.aspx?%2fZZ+-+Development%2fHardware+Network+Information+for+DistrictComputer&rs:Command=Render&District="+Fields!altdistrict.Value+"&Name="+Fields!name.Value+"'))" The following works except if District name has a special character in it such as QA_ITE&A Is there anyway I can pass the district value so that the & will not be interpreted as an & command operator..? Anyway I can Pass Parameters!DistrictName.Value through encodeURIComponent. ? So far can't find the correct way to do this? |
|
| Tuesday, August 24, 2010 - 3:43:20 PM - Rob | Read The Tip |
|
Hi Reda, I don't know if this will help, and it's just a wild guess, but perhaps you could try replacing the special character (&) with it's hex equivant preceeded by a percent (%) sign. You can look them up on a page like this: http://www.ascii.cl/htmlcodes.htm You may have to do this in the support query or in the report using the 'replace' function. Notice in the example javascript URL there are many places where '%2f' appears? This replaces the '/' in a URL path. It's just a guess, but you could try it. Rob |
|
| Wednesday, September 22, 2010 - 11:44:02 AM - Leon Chuck Gosslin | Read The Tip |
| You can cause a link to open in a new window by sending in the "&rc:LinkTarget=_blank" in the main report URL parameter. This causes all links on the main or parent report to open in a new window when clicked. Of course this makes all the links open in a new window. If you just want a single link to have this behavior, you will have to use the above method. | |
| Sunday, October 31, 2010 - 7:55:49 AM - Wim Havenstein | Read The Tip |
|
Great tip Rob, It works okay on my test server. However in the live environment I have got two servers: 1 sql server (sqlsrv) with rs on it and 1 iis server (applsrv). Running the report on applsrv server via report manager works okay. But running the same report on applsrv as a link in a web based program (http://xx-sqlsrv/Reportserver$sql2005?/partoer/medewerkersreport&rs:Command=Render) the drill down url comes up with javascript:void(window.open('http://applsrv/synergy/docs/EPRequest.asp?Action=1&ID=%7BF3FD5DC4-8DA2-44B9-8D5F-6AB54A47C202%7D','_blank')) in stead of 'http://applsrv/synergy/docs/EPRe.... Do I have to install RS on applsrv as well or is there an easy solution? Thanks Wim |
|
| Tuesday, May 31, 2011 - 4:27:35 AM - Khurram | Read The Tip |
|
Hi Reda, its a great article. but i am stuck with one issue, while passing dynamic variable in URL my syntax is not working for some reason. although i am following exactly the way you have mentioned, but when i try to pass the field.value, the hyperlink disappears at all. it never gives me an error, instead it stops allow me to click on on the text box, and the text box become a normal text box without any link. this is my syntax:
= "javascript:void(window.open(http://ss-jhq-sspmo-2/ReportServer/Pages/ReportViewer.aspx?%2fPMO+Dashboard%2fBA_SSRS_Prjt_Level_MilestonePerProject&rs:Command=Render&Project_UID="=Fields!ProjectUID.Value+"'))" please help i have already wasted quite a lot of time to resolve this. |
|
| Tuesday, May 31, 2011 - 8:12:53 AM - Rob Fisch | Read The Tip |
|
Hi Khurram, It looks like you need to replace the = sign with a + sign just before the word "Fields" toward the end. Like this: "javascript:void(window.open(http://ss-jhq-sspmo-2/ReportServer/Pages/ReportViewer.aspx?%2fPMO+Dashboard%2fBA_SSRS_Prjt_Level_MilestonePerProject&rs:Command=Render&Project_UID="+Fields!ProjectUID.Value+"'))" Check my syntax in the article carefully. ROb |
|
| Monday, March 05, 2012 - 12:17:00 PM - Nan | Read The Tip |
|
This works great for us, but I have a question. Is there a way to control where the window pops up? I have a main report, that has a drill through report that has a drill through report, etc. down to 4 levels of drill through. Each report opens in a new window (which is exactly what I want), however, I would like to have each cascade down from the main report when the link is selected. Right now it would appear the the first drill through cascades, but then when I click the link on that report, that drill through report seems to open at the top left of the monitor instead of cascading down. I have been searching for a solution, but have been unsuccessful. Thank you |
|
| Wednesday, May 02, 2012 - 4:54:57 AM - Nivatha | Read The Tip |
|
Hello, Great article but I have problems using Javascript. I have the complete URL as a Field value and I am trying to use that value in Go to URL property of a textbox from VS2008. Without the javascript it works fine but when provided within the javascript it fails to do anything. Here's my expression ="javascript:void(window.open('"+Fields!SprintURL.Value+"'))" Not sure where I am going wrong with this. Any help would be greatly appreciated. Thanks |
|
| Tuesday, May 15, 2012 - 1:38:11 AM - Suresh | Read The Tip |
|
Hi, Very Good Article. I am using below code in Jump to URL,New window is opening but paramter is not getting passed to report. I am getting error as parameter the 'cat' parameter is missing a value. ="javascript:void(window.open('http://localhost/Reports/Pages/Report.aspx?ItemPath=%2fDemo+Project%2fReport22&rs:Command=Render&Cat="+Fields!SubCategoryName.Value+"'))"
OR ="javascript:void(window.open('http://localhost/Reports/Pages/Report.aspx?ItemPath=%2fDemo+Project%2fReport22&rs:Command=Render&Cat=Bottom Brackets'))"
Please anyone can help me solve this issue.
Thanks and Regards, Suresh S. |
|
|
privacy | disclaimer | copyright | advertise | about authors | contribute | feedback | giveaways | user groups Some names and products listed are the registered trademarks of their respective owners. Edgewood Solutions LLC | MSSharePointTips.com | MSSQLTips.com |