2

I want to pass report parameters within ssrs url, but one of the values of a parameter contains &, so url won't work.

example:

https://myrshost/ReportServer?/AdventureWorks2008R2/Employee_Sales_Summary_2008R2&ReportMonth=3&&Category=cup&saucer&ReportYear=2008

In this example the is & in value of parameter Category.

Currently as a work around I am replacing the value which I pass to category with

REPLACE(CategoryParameterValue,"&","(and)") 

and then in the dataset I am replacing (and) back to &. This work around works fine, but I want to check whether there is any other solution for this issue.

Please help.

Hadi
  • 36,233
  • 13
  • 65
  • 124
NiveaGM
  • 249
  • 2
  • 11

2 Answers2

1

The & must be encoded before being passed in URL. The encoded form is %26.

References

Hadi
  • 36,233
  • 13
  • 65
  • 124
1

I solved this issue by replacing & with '+escape('&')+' in the parameter value

Hadi
  • 36,233
  • 13
  • 65
  • 124
NiveaGM
  • 249
  • 2
  • 11
  • `escape('&')` gives as result `%26` as i mentioned – Hadi Feb 06 '19 at 17:19
  • 1
    Hi @Hadi, replacing with %26 won't work when the url is called as a popup using javascript:void(window.open()) because '%26' is converted back to '&' in the url by the function. But escape('&') works. – NiveaGM Feb 07 '19 at 15:00
  • You're right. But you didn't mentioned thatyou are using js. +1 – Hadi Feb 07 '19 at 16:27