Query Based Report Parameters

  • I have a report, which runs two different ways. One way it can run, is directly from the report web server. The other way is from the .net windows application I wrote. I would like to focus on running the report from the application.

    The report has a parameter which retrieves its data from a query. However, I would like to suppress this action when I pass a value to this report via the application. Is this possible?

  • what you need sounds straightforward but without your sql it's hard to suggest an appropriate solution. something like this may work:

    if (@parm is null )

    select @parm = [value] from {existing query}

  • From what I know about reporting services, retrieving values for parameters are based on datasets. So I am assuming you mean to put that if statement in the sql somehow? Since you cannot do it the parameter definition?

  • you can define a parameter to allow null values or default values. thus the report can execute without supplying a value in which case the if logic i provided will determine it's value.

  • As I understand your query, you want to simply suppress the parameter query from executing, if you've already supplied a value. This assume that the value is correct.

    As far as I know, you can't do this. The reason, is that RS is validating the value you supplied against the results in the query. If it's not found, then it'll prompt for the correct value (based on the query). You should be able to see this in action, by simply supplying an incorrect value.

    Assuming you have a good reason for doing this (i.e. you're trying to address performance), consider the following:

    - Is there anything you can do to lower the cost of the query? Any improvements on the back end?

    - You could optimize the query, by making it dependent on another parameter. This hidden parameter would default to some higher value and your parameter would only list dependent entries (i.e. .Children in MDX).

    - If you're calling from your application, you're override the hidden parameter, with some more specific value (to improve performance). Then, your query parm executes/returns a small set.

    If you've got another reason, post back and we'll see what we can figure out.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply