question

markgoldin-3750 avatar image
0 Votes"
markgoldin-3750 asked cooldadtx commented

SSRS report - XML query with report parameter

Is it possible to use a report parameter in the xml query?

<Parameter Name="TOTP">
<DefaultValue>Report Parameter here</DefaultValue>
</Parameter>

Thanks

sql-server-reporting-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

cooldadtx avatar image
0 Votes"
cooldadtx answered cooldadtx commented

Should not be an issue. A parameter is just a variable whose value is managed at runtime based upon the UI/data sent to the server. Therefore you can use the parameter in any dataset query whether it is XML or not doesn't matter. Just use the standard @name syntax but this is assuming you're building the XML query like you would in SSMS and not doing something else. Test the query in SSMS first and then you can transfer it to SSRS.

· 11
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

That query is a SOAP call. When I run it as <DefaultValue>@Parameter_Name</DefaultValue>
I am getting an error from the backend if I would have provided wrong parameters.
I also tried Parameters!TOTP.Value, still the same.

0 Votes 0 ·

So you're writing some code to make a SOAP call and not trying to query a database using XML then. Can you post the exact code you're using? Note that calling SOAP from SSRS isn't trivial (or anything that doesn't support a SOAP client for that matter) so I would start with the question of whether you can get the query to work or not with just hard coded values. If it doesn't work for them then parameterizing it only makes it harder and the issue isn't with the parameters.

0 Votes 0 ·

Sure, I can. I also tried an expression with string concatenation: ="first part" $ Parameters!TOTP.Value % "second part". That expression placed in the textbox shows the correct result, but as expression for a dataset it simply not executing. Also when I use an expression for a dataset it complains about not being able to a list of fields. As a result it's not possible to place the results in a visual, that's why it's probably not executing.

0 Votes 0 ·
Show more comments