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?
 
itfocusConnect With a Mentor Author 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
 
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:
Found the answer myself, and posted to help others.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.