Friday, March 30, 2012

Jump to URL - New Window - Ampersand

I have a Jump to URL hyperlink action using the "javascript:
void(window.open)" code. This works great, except when one of the parameters
contains an ampersand. I get an error saying that the "path of the item is
not valid. The full path must be less than 260 characters long, muster start
with slash..."
One of my parameters for the report that first comes up is
"OfficeDescription" which may contain an ampersand ("Boise R&D"). I'm
passing this to the URL as listed below. It only fails if there is that
ampersand in the OfficeDescription ("Boise Sales" works fine). I'm tried
replacing the "&" with %26 but I can't get that to work.
This works fine if I use a "Jump to Report" and pass the parameters that
way, but I need to pop up the report in a new window.
="javascript:void(window.open('"&Globals!ReportServerUrl+ "?" &
Globals!ReportFolder & "/Producer Detail&OfficeDescription=" &
Parameters!OfficeDescription.Value & "&Producer=" & Fields!Producer.Value &
"&rc%3aParameters=false','_blank','height=530px,left=1px,location=no,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top=1px,width=780px'))"
Thanks for any advice anyone cares to offer!Parameter values must be URLEncoded. Please perform the following steps:
* load the report in report designer
* go to the report menu -> report properties -> References tab
* in the "References:" list, add a reference to System.Web, and click OK
* in the report, modify your expression to use the HttpUtility.UrlEncode
function (see MSDN:
http://msdn2.microsoft.com/en-us/library/system.web.httputility.urlencode):
="javascript:void(window.open('"&Globals!ReportServerUrl+ "?" &
Globals!ReportFolder & "/Producer Detail&OfficeDescription=" &
System.Web.HttpUtility.UrlEncode(Parameters!OfficeDescription.Value) &
"&Producer=" & System.Web.HttpUtility.UrlEncode(Fields!Producer.Value) &
"&rc%3aParameters=false','_blank','height=530px,left=1px,location=no,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top=1px,width=780px'))"
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"kaibh" <kaibh@.discussions.microsoft.com> wrote in message
news:7EAE0CF0-2C9C-47A8-8A2D-B5861AFA5740@.microsoft.com...
>I have a Jump to URL hyperlink action using the "javascript:
> void(window.open)" code. This works great, except when one of the
> parameters
> contains an ampersand. I get an error saying that the "path of the item
> is
> not valid. The full path must be less than 260 characters long, muster
> start
> with slash..."
> One of my parameters for the report that first comes up is
> "OfficeDescription" which may contain an ampersand ("Boise R&D"). I'm
> passing this to the URL as listed below. It only fails if there is that
> ampersand in the OfficeDescription ("Boise Sales" works fine). I'm tried
> replacing the "&" with %26 but I can't get that to work.
> This works fine if I use a "Jump to Report" and pass the parameters that
> way, but I need to pop up the report in a new window.
> ="javascript:void(window.open('"&Globals!ReportServerUrl+ "?" &
> Globals!ReportFolder & "/Producer Detail&OfficeDescription=" &
> Parameters!OfficeDescription.Value & "&Producer=" & Fields!Producer.Value
> &
> "&rc%3aParameters=false','_blank','height=530px,left=1px,location=no,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top=1px,width=780px'))"
> Thanks for any advice anyone cares to offer!
>|||Robert, thanks for the feedback, however I'm still getting the same error:
Reporting Services Error
The path of the item '/OnDemand/Producer Detail,C' is not valid.The full
path must be less than 260 characters long, must start with slash; other
restrictions apply. Check the documentation for complete set of restrictions.
(rsInvalidItemPath)
The HTML generated for this link looks like:
<a style="text-decoration:none;color:Black"
href="javascript:void(window.open('https://my.reportserver.com/ReportServer?/OnDemand/Producer%20Detail&OfficeDescription=Boise+r%26D&Producer=JSL&rc%3aParameters=false','_blank','height=530px,left=1px,location=no,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top=1px,width=780px'))" TARGET="_top">JSL</a>
The "Boise R&D" is getting encoded as "Boise+R%26D", so that's good right?
But since I'm still getting this error, I assume there must be something else
that I'm missing.
Thanks
"Robert Bruckner [MSFT]" wrote:
> Parameter values must be URLEncoded. Please perform the following steps:
> * load the report in report designer
> * go to the report menu -> report properties -> References tab
> * in the "References:" list, add a reference to System.Web, and click OK
> * in the report, modify your expression to use the HttpUtility.UrlEncode
> function (see MSDN:
> http://msdn2.microsoft.com/en-us/library/system.web.httputility.urlencode):
> ="javascript:void(window.open('"&Globals!ReportServerUrl+ "?" &
> Globals!ReportFolder & "/Producer Detail&OfficeDescription=" &
> System.Web.HttpUtility.UrlEncode(Parameters!OfficeDescription.Value) &
> "&Producer=" & System.Web.HttpUtility.UrlEncode(Fields!Producer.Value) &
> "&rc%3aParameters=false','_blank','height=530px,left=1px,location=no,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top=1px,width=780px'))"
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.|||I also am trying to do this. It works great in the IDE, but I get the
following error when publishing the report to Report Manager on my local
machine and any servers.
Request for the permission of type System.Web.AspNetHostingPermission,
System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed.
It is probably permissions. How would I modify rssrvpolicy.config to allow
the execution of System.Web assembly?
Dan Bock
"kaibh" wrote:
> Robert, thanks for the feedback, however I'm still getting the same error:
> Reporting Services Error
> The path of the item '/OnDemand/Producer Detail,C' is not valid.The full
> path must be less than 260 characters long, must start with slash; other
> restrictions apply. Check the documentation for complete set of restrictions.
> (rsInvalidItemPath)
> The HTML generated for this link looks like:
> <a style="text-decoration:none;color:Black"
> href="http://links.10026.com/?link=javascript:void(window.open('https://my.reportserver.com/ReportServer?/OnDemand/Producer%20Detail&OfficeDescription=Boise+r%26D&Producer=JSL&rc%3aParameters=false','_blank','height=530px,left=1px,location=no,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top=1px,width=780px'))" TARGET="_top">JSL</a>
> The "Boise R&D" is getting encoded as "Boise+R%26D", so that's good right?
> But since I'm still getting this error, I assume there must be something else
> that I'm missing.
> Thanks
>
> "Robert Bruckner [MSFT]" wrote:
> > Parameter values must be URLEncoded. Please perform the following steps:
> > * load the report in report designer
> > * go to the report menu -> report properties -> References tab
> > * in the "References:" list, add a reference to System.Web, and click OK
> > * in the report, modify your expression to use the HttpUtility.UrlEncode
> > function (see MSDN:
> > http://msdn2.microsoft.com/en-us/library/system.web.httputility.urlencode):
> > ="javascript:void(window.open('"&Globals!ReportServerUrl+ "?" &
> > Globals!ReportFolder & "/Producer Detail&OfficeDescription=" &
> > System.Web.HttpUtility.UrlEncode(Parameters!OfficeDescription.Value) &
> > "&Producer=" & System.Web.HttpUtility.UrlEncode(Fields!Producer.Value) &
> > "&rc%3aParameters=false','_blank','height=530px,left=1px,location=no,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top=1px,width=780px'))"
> >
> > -- Robert
> > This posting is provided "AS IS" with no warranties, and confers no rights.
>

No comments:

Post a Comment