Is it possible to dynamically change the value of one parameter, based upon what the user selects for another parameter?

  • I've got a report which I've now got to change, by adding a fourth parameter. The first 2 parameters are datetime values, easily gotten. The third is a string, but is gotten from a dropdown which I've specified the allowable types. I had erroneously thought that the fourth parameter wouldn't need to be passed, but could be calculated within the stored proc; it is based upon whatever was chosen for the third parameter.

    Or at least that was my initial understanding. Now I'm changing the stored proc to require a 4th parameter and the report to also require it. What would be nice, though, is if the report would "see" what the user has selected from the dropdown and then assign an initial value to the fourth parameter. The user could change that, if they wanted to, or go with what was selected. This would be consistent with the way the report used to owkr in their old MS Access report.

    So is it possible to do this with SSRS 2012? And if so, how? BTW, the fourth parameter is going to be a integer >0.

    Kindest Regards, Rod Connect with me on LinkedIn.

  • How are you getting the values for your fourth parameter?

    You could use a dataset with requires a parameter to assign the default value.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • At this point its just a plain, vanilla let the user enter it by hand on the SSRS report interface. I've restricted it to an integer data type and that the fourth parameter is required, but there's no other requirements other than that.

    Kindest Regards, Rod Connect with me on LinkedIn.

  • The only way you could do this would be to have the 4th parameter get its available values provided from a dataset, which has the 3rd parameter (and any others it may need) provided to it so that it only returns valid values.

    When you load the report doing this, the 1st, 2nd and 3rd parameters will all be available, but the 4th will be grayed out. Once you select the compulsory parameters, the 4th will be available for selection as well.

    For example if you had a table as below:

    Insert into [SSRSExample] (Name, DeptID)

    Values (N'Steve', 1),

    (N'John', 1),

    (N'Dave', 2),

    (N'Gina', 2),

    (N'Paula', 2),

    (N'Daniel', 3),

    (N'Bobby', 4)

    Your 3rd parameter supplies a distinct list of DeptIDs, so you would have a dataset that has the following query to provide available values for Parameter 4:

    Select Name

    from SSRSExample

    where DeptID = @DeptID

    Providing 2 into the dataset would cause parameter 4 to only provide the values Dave, Gina and Paula in a drop down box.

    Does this help/make sense?

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

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

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