question

juniormint-2446 avatar image
0 Votes"
juniormint-2446 asked Joyzhao-MSFT edited

SSRS escape ampersand for sub report link

I have the following code to use to create a new tab for sub reports:
="javascript:void window.open(" &"'"& Globals!ReportServerUrl &"/Pages/ReportViewer.aspx?"&Globals!ReportFolder &"/SRpt_NonInvTransSumBulkDispBalByHauler&CarrierName="&Fields!Carrier_Name.Value &" ','_blank')"

It works well unless I run across a sub report link that contains an "&" i.e. J&B Enterprises.

Can someone please tell me how to escape the ampersand?

Any help will be greatly appreciated!

juniormint

sql-server-reporting-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Joyzhao-MSFT avatar image
0 Votes"
Joyzhao-MSFT answered Joyzhao-MSFT edited

Hi @juniormint-2446 ,
From my research, the effective method is to use Escape Function for javascript. The escape() function was deprecated in JavaScript version 1.5. Use encodeURI() or encodeURIComponent() instead.

You could refer to the case: SSRS - Opening sub-report in a new window "&" issue.
Hope this helps.
Best Regards,
Joy


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.