2016-08-17 57 views
0

略显混乱冠军,但我难倒不过。SSRS 2008 - 使用JavaScript的URL编码与符号

我有一个可点击的链接,这将打开您的默认邮件客户端(在这种情况下,我们是Outlook)中,并格式化可点击的URL。它在99%的时间内效果很好,除非网址中有&符号。我已经取代了&有26%和&没有运气。网址仍然会切断连字符的位置。

在SSRS,我有这样的设置为超链接表达

=iif(Fields!EmailShippingURL.Value="URL Unavailable" OR Fields!ShippingURL.Value="URL Unavailable" OR isNothing(Fields!EmailShippingURL), "javascript:(alert('The shipment info cannot be processed. There is either no email address for this contact or invalid shipping information.'))", "javascript:void(window.open('"+ Fields!EmailShippingURL.Value + "','_blank'))") 

回答

0

我想你可以使用CHR()函数 -

"javascript:void(window.open('"+ replace(Fields!EmailShippingURL.Value, "&", chr(38)) + "','_blank'))" 

和JavaScript逃生功能 -

"javascript:void(window.open('"+ replace(Fields!EmailShippingURL.Value, "&", "'+escape('&')+'") + "','_blank'))"