NiveaGM
NiveaGM

Reputation: 259

Passing parameter to SSRS url issue when parameter value have '&'

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.

Upvotes: 2

Views: 637

Answers (2)

NiveaGM
NiveaGM

Reputation: 259

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

Upvotes: 1

Hadi
Hadi

Reputation: 37348

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

References

Upvotes: 1

Related Questions