April 25, 2006 at 2:21 pm
Can not recall (shame on me!) how I've done this before- open hyperlink in new window (LinkTarget, target..?). Thanks in advance
April 26, 2006 at 6:41 am
target="_blank"
maddog
April 26, 2006 at 7:54 am
Cool. Where/how I need to point this? Thanks
April 26, 2006 at 8:53 am
The method I think is the cleanest:
1) First set up a custom routine that does the work of navigating to your target, by creating a code module on the properties of the report - e.g.:
Public Function JumpToURL(arg_AcctPeriod as integer, arg_FieldID as integer) as String
Dim sURL
If arg_FieldID <> 0 Then
sURL = "<A HREF='http://YourTargetPage.aspx?AcctPer=" + CStr(arg_AcctPeriod + "&FieldID" + CStr(arg_FieldID) + " TARGET='_blank'></A>"
Else
sURL = ""
End If
Return sURL
End Function
This code example is set up for a jump to a specific URL with specific parameters, but with a bit more work you can make a generic jump code module where you construct the URL and any querystring in the expression of the calling field and just pass it to the Jump method.
I have had problems in using the expression alone in the Jump to URL to navigate to other areas from an RS report, so I ended up using the code method and have not had any problems with it yet.
2) Go to Navigation tab on Advanced Properties for report detail field or object you want to jump from
3) Select the 'Jump to URL' option, and enter the call to the custom code module into the jump expression passing any variables from the report fields or parameters - e.g.:
=Code.JumpToURL(Parameters!AcctPeriod.Value, Fields!FieldToPassID.Value)
maddog
April 26, 2006 at 2:22 pm
OK, thanks, I'll try this way. I remember that when I've done this last time I did not create any custom function. Anyhow, thanks one more time
April 27, 2006 at 10:18 am
Have no idea why is this but your way does not work for me (sorry). I mean when I build html string as you pointed RS does not recognize it as url (for example, if I directly print in "Jump to URL" text box this string:="<a href='http://www.microsoft.com'></a>" it does not work but this string:="http:/www.microsoft.com" is OK). It seems to me that RS does not like html or I am doing something wrong. Thanks
April 27, 2006 at 11:56 am
How are most users going to be viewing the report as a finished product? If the reports will be requested and rendered always as within the standard RS manager report viewer, the report designer viewer, or distributed in a scheduled email as HTML or other non-browser container, then there is no need to specify the 'target='_blank' as the containrer will force a new browser to open in those cases with just a plain URL. Reports rendered as a web archive or other rendering container that are browser-based will need to have the target=_blank specified or else the browser will simply jump away from the main report and show the new URL as you've undoubtedly discovered.
Funny though that the code sample for doing this isn't working for you as it does for me, I'll try to play with this a little later to maybe see why. I am running client report designer and RS server at SP1 but I doubt that would have an effect if you have SP2.
maddog
April 27, 2006 at 12:48 pm
Thanks, man, for your response and help. Our RS is on Sql Server 2005 and I use BI Development Studio for Sql Server 2K5 also. Thanks
April 27, 2006 at 1:07 pm
I need you to talk to my boss to get us SQL Server 2K5 - we are currently stuck at 2K with no upgrade in sight. I find it hard to believe tho that in this specific case the URL jump capabilities are that different or broken so that it doesn't work between versions.
maddog
April 27, 2006 at 2:45 pm
I just tryed on Sql Server 2K (SP3)- same story (we have second RS), i.e. if function comprises direct "pure" url like "http://www.microsoft.com" everything is OK, but in case of html string like "<a href='http://...></a>" it does not work at all (generate error). Can not understand why it works for you and does not- for me. Thanks
April 28, 2006 at 10:11 am
Another option you can try if you are relatively sure that the audience of the reports won't have javascript blocked or company policy has popups blocked is to use the format of the following script, directly in the Jump to URL expression:
="javascript:void(window.open('http://YourTargetPage.aspx?AcctPer=" + CStr(Fields!AcctPer.Value) + "&FieldID" + CStr(Fields!FieldID.Value)" + ",'_blank'))"
Note that when testing this in preview mode of the report designer you will actually get two new browser windows open, one with the javascript in the URL and no page content, and the other with the proper target page. It works fine with only one window open if the report is rendered within a browser-based container.
maddog
April 28, 2006 at 10:18 am
Note the above solution carries a disclaimer: although it works we don't use it as most of our reports are distributed on a data-driven subscription as HTML embedded within emails - depending on the client's EMail program, it will freak out in most cases trying to run the javascript from the embedded report HTML and\or sound all manner of security alarms.
maddog
April 28, 2006 at 11:46 am
Thanks, this way works
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply