Passing report parameters to webservice datasource in SQL Reporting Services

Hi,

I have a query in SSRS which is working perfectly and returning the correct data from a webservice on my live webserver when I hard code the parameter value in, however, I need this to be dynamic, and to be a parameter passed into the report itself.  I cannot work out what the syntax for this is though, as nothing I have tried seems to work.

Here is the query (the report parameter I need to pass in is called CompanyID):

<Query>
<SoapAction>http://tempuri.org/GetTicketTotalsThisMonth</SoapAction>
<Method Name="GetTicketTotalsThisMonth" Namespace="http://tempuri.org/">
<Parameters>
<Parameter Name="CompanyID">Parameters!CompanyID.Value</Parameter>
</Parameters>   
</Method>
<ElementPath IgnoreNamespaces="true">*</ElementPath>
</Query>

Open in new window


I have tried Parameters!CompanyID.Value, =Parameters!CompanyID.Value, @CompanyID, [@CompanyID]... all to no avail.

If anyone knows what the correct syntax is for this, I would be very grateful, as it's driving me crazy!

Thanks.
itfocusAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

trawleyCommented:
Have you set up the parameters on the report itself? I.e there is a facility in Ssrs to declare and bind parameters.
0
itfocusAuthor Commented:
Hi,

I have set up this parameter in the report, and I specify a value for it when I run the report.  I can write the parameter value to the report itself (for testing) using Parameters!CompanyID.Value, but for some reason this value is not accessible in the datasource query.
0
itfocusAuthor Commented:
I have finally found a solution to this, posting it here in case it saves someone else some hours of frustration:

Basically, the query needs to be like this (i.e. with nothing in the default value):
<Query>
<SoapAction>http://tempuri.org/GetTicketTotalsThisMonth</SoapAction>
<Method Name="GetTicketTotalsThisMonth" Namespace="http://tempuri.org/">
<Parameters>
<Parameter Name="CompanyID">Parameters!CompanyID.Value</Parameter>
</Parameters>   
</Method>
<ElementPath IgnoreNamespaces="true">*</ElementPath>
</Query>

Open in new window


The parameter needs to be set in the dataset properties, as the name of the parameter being passed to the webservice, and the value of the report parameter.  This didn't work for me initially because you have you specify the fields returned by the query in the Fields section of the dataset so the report knows what it is expecting.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
itfocusAuthor Commented:
Found the answer myself, and posted to help others.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.