SSRS 2008 - Go To URL in new window- With out breaking the print out
I know the Javascript method to open a new report everyone has asked and answered that. My question is how can we implement this without breaking the printing functionality. If you use the javascript when you print to PDF or Excel you get an error about the javascript and the link does not work. So you end up with a file that looks like it has a link but produces a disastrous error. Perhaps my question should be "where do I report this seemingly glaring oversight"? I say glaring because it has been over 6 years for SSRS and essential basic functionality of a html URL like "target = _New" is still not implmented and we have to use a more complex javascript work around that does not work in rendered documents. Most people asking about this are familiar with the Html syntax of "target=_New" and it seems fairly basic to me. I would appreciate any assistance. Thanks, Collin
May 28th, 2012 12:09pm

Hi Collin, From your description, the URLs placed in JavaScript dont work when exporting the report to PDF or Excel. This is a known issue. To work around it, I suggest that you create a parameter to determine whether the rendering format is PDF/Excel or not, and then set the drillthrough action of the target textbox in the report by using the expression below: =IIf(Parameters!RenderFormat.Value=True, "<URL>", "javascript:void(window.open('<URL>'))") You can set the default value of the parameter to False. That way, the users change the parameter value only when exporting the report to PDF/Excel. Hope this helps. Regards, Mike Yin
Free Windows Admin Tool Kit Click here and download it now
June 1st, 2012 6:15am

Hi Collin, From your description, the URLs placed in JavaScript dont work when exporting the report to PDF or Excel. This is a known issue. To work around it, I suggest that you create a parameter to determine whether the rendering format is PDF/Excel or not, and then set the drillthrough action of the target textbox in the report by using the expression below: =IIf(Parameters!RenderFormat.Value=True, "<URL>", "javascript:void(window.open('<URL>'))") You can set the default value of the parameter to False. That way, the users change the parameter value only when exporting the report to PDF/Excel. Hope this helps. Regards, Mike Yin
June 1st, 2012 6:18am

I did the creating a manually selected parameter and got immediate push back from my users. So I dug in further and I've been able to successfully workaround this issue without an additional parameter by using the "Globals!RenderFormat.Name" built in field in SSRS. In SSRS 2008 R2 this field generates a flag for the output format. In the case of a report server rendering of the report, the value generates as follows: Globals!RenderFormat.Name = "RPL" When it runs in excel it generates as follows: Globals!RenderFormat.Name = "EXCELOPENXML" It will generate other values for other formats, but since we know when we are running on the web, we can just use that value. Basically you can use Globals!RenderFormat.Name as a condition to know when to render a JavaScript call and when it's a direct URL (in the case of non-web formats). Here's what you would need to put in your Action > Go to URL: =IIF(Globals!RenderFormat.Name = "RPL", "javascript:void(window.open('<URL>'))", '<URL>') I have not tested every format and every deployment scenario, but it did work for report server (2008 & 2012), SharePoint 2010 Integrated and Excel without any issues. Best of luck, Thor
Free Windows Admin Tool Kit Click here and download it now
June 6th, 2012 3:16pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics