SSRS - Opening sub-report in a new window "&" issue

  • Hi Folks,

    SSRS 2008 - BI Dev Studio 2008 - IE 9.0

    I am trying to open a sub-report from within an existing piechart that I have deployed on the ReportViewer page.

    It all works fine apart from my discovery that some of the field values contain an "&" and I can't seem to get it to work e.g. Tom & Jerry:

    I originally passed the below javascript to my Series Properties->Action->Select URL Expression within the PieChart:

    ="void(window.open('http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fLAQuotesSQLReports%2fRFT+Report&rs:Command=Render&LocalAuthority="+Fields!OrgName_tcc.Value+"&rc:Parameters=false'))"

    However I found out that because some of the data values in the +Fields!OrgName_tcc.Value+ field contain an "&" it was giving me trouble for these fields only (it all works fine if no "&" exists). I get the following error:

    Reporting Services Error

    The path of the item '/LAQuotesSQLReports/RFT Report, Town Councils' is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash. (rsInvalidItemPath)

    SQL Server Reporting Services

    URL is as follows:

    http://localhost/ReportServer/Pages/ReportViewer.aspx?/LAQuotesSQLReports/RFT+Report&rs:Command=Render&LocalAuthority=Cork%20County%20Council%20&%20Town%20Councils&rc:Parameters=false

    So I tried doing something like this but still get the "&" returning in my url:

    ="void(window.open('http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fLAQuotesSQLReports%2fRFT+Report&rs:Command=Render&LocalAuthority="+REPLACE(Fields!OrgName_tcc.Value,"&","%26")+"&rc:Parameters=false'))"

    If I change the url directly from my browser from "&" to %26 it works fine!!! So seems like my replace function is the problem.

    Any suggestions??

    Thanks.

  • SOLUTION:

    ="void(window.open('http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fLAQuotesSQLReports%2fRFT+Report&rs:Command=Render&LocalAuthority="+REPLACE(Fields!OrgName_tcc.Value,"&","%2526")+"&rc:Parameters=false'))"

    :satisfied:

  • Use ESCAPE function for javascript..

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • Hi Chinna,

    How would the ESCAPE function look in the url as this would be handy to know also.

    Thanks.

  • escape() function in javascript to substitute the ampersand character with its URI value of %26:

    http://www.bp-msbi.com/2008/09/advanced-javascript-in-reporting/[/url]

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • Thanks for that.

    I get 'unrecognized identifier'. Name Escape is not declared.

    Do I have to declare this somewhere within my SSRS Code?

    Cheers

  • Can you please post the full link using in ssrs

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • ="void(window.open('http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fLAQuotesSQLReports%2fRFT+Report&rs:Command=Render&LocalAuthority="+escape('" & Fields!OrgName_tcc.Value & "')+"&rc:Parameters=false'))"

  • Try this format and let me know if it doesnt work ..

    ="void(window.open('"+ Globals!ReportServerUrl + "?" + Globals!ReportFolder +

    "%2fReport_Name&rs:Command=Render" +"&Test='+escape('"+Parameters!Test.Value.ToString() +"') +'&Test1='+escape('"+Parameters!Test1.Value.ToString() +"') + '', 'newwin', 'screenX=0,left=0,screenY=0,top=0,status=1,menubar=1,resizable=1,scrollbars=1,toolbar=1,location=1'))"

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • Chinna,

    That worked a treat!

    Thank you.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply