How to hide parameter based on another parameter value in SSRS - reporting-services

I have 2 parameters param1 and param2. param1 has values true and false. My requirement is that if I select true in param1 then param2 should be hidden and if I select false in param1 then param2 should be visible. Can this be achieved in SSRS?

As per Nathan's comment I am adding Amar's comment here as answer/partial answer
Unfortunately, you cannot change a parameter's visibility during run time. Alternatively, you can control the second parameter's values based on the selected value of the first parameter.
Check this post - Hide parameter (dropdown control from the toolbar) in SSRS based on another Parameter

As Amar pointed out you cannot hide parameters dynamically, but what you can do is grey them out for single-value parameters, described here.
For multi-value parameters that won't work, because multi-value parameters are not allowed to be null.
But instead you can modify your DataSet and the default value for the parameter. To limit the user's choice list.
Let me give you an example:
Let's say you have 2 parameters that are cascaded. So you want to choose something from the first parameter and depending on what you choose in the first parameter you get a different result in second parameter. (Microsoft has a documentation about this)
Now we can use this cascading to set the values in the second parameter. So for instance if we choose the value 1 in the first parameter we want the second parameter act normal and show its data to choose from, but in any other case we want the second parameter to have limited data to choose from. And this what I'm going to show. You got a second parameter that looks like this:
In the Available Values we choose the DataSet with its values and labels for the second parameter. Which could look like this:
Now in the DataSet for the second parameter, here DataSet1, we need to specify when to show the limited data and when not:
So what we do is set one label All with the value -1 when the value of the first parameter is not 1 else the DataSet returns all the data from the table/function/stored procedure/ etc.
Lastly the second parameter shall have the default value -1 with the label All chosen when the first parameter is not 1. So back to the second parameter properties. For Default Values the value -1 needs to be specified:
So now the user only gets the preselected All in the list to choose from when the first parameter is not 1. Otherwise the full list will be provided. All that has to be done now is to declare what is done when the value of the second parameter is -1.

Related

SSRS Parameter value based on other Parameter value not working using LEFT

I have an issue with SSRS parameters. I have a parameter that is based on a dataset value. This parameter is called UserOffice and correctly returns value GB10. I have a second parameter called IncludePrimary that returns the value of UserOffice (=Parameters!UserOffice.Value):
I then change the value of the IncludePrimary expression to be the first 2 characters of UserOffice (=Left(Parameters!UserOffice.Value, 2)):
I expected the field to show GB. Can someone please tell me what I am doing wrong?
Thanks
Rob
A parameter (your second one) isn't "updated" (the default value isn't re-applied) while the currently selected value(s) is (are) still in the list of available values after other parameters have been changed.
To update the second parameter, you must not only change its Default Value but will need to set its Available Values as well:
Or, of course, you can simply use your expression Left(Parameters!UserOffice.Value, 2) whenever you need it, so you don't need that second parameter at all.
Thanks to everyone who replied. They responses were very helpful. In order to resolve my issue I created a second dataset that calculated the default value (Y or N). I used set Available Values and then used my new dataset to set the default.
It works a treat.
Rob

Populate a parameter dropdown based off another parameter

I am trying to populate a dropdown based off another dropdown parameter. I have 5 parameters, but the first 3 populate the 4th in the report. So the 4th and 5th parameter are what the user uses to populate a report. So the 4th parameter (meetings) has a meetings dataset and the 5th parameter is meetingType with a dataset of meetingType. So when the user selects a meeting, then the meetingType gets populated by that selection. Currently both dropdowns produce all results, which I don't want. I just want all results for meetings and then the meetingType gets populated by meeting.
The table it produces once the report is ran doesn't use those properties and there isn't a place to query anything. I can only use available values from each dataset and not use available values based on the selection of the 4th parameter.
I'm not really clear. do you need a parameter or do you just want to have the meeting type available as a value in your report output?
Fairly straightforward. You have two datasets, one for each parameter. You need to filter the second dataset based on the first parameter.
For example, I often create reports that ask for a range of values, let's say programs. Once the user has entered the beginning value, the ending value must be greater than or equal to the beginning value. So, on the ending value dataset I create a filter. In this case, the filter says that the field code (which is my program) must be between the starting parameter and the maximum value allowed:
You can make your filter as complex as needed - referring to the other parameter with a formula
You can also do this via separate datasets for each parameter.
Lets say you have two parameters #param1 and #param2
you want the values on #param2 to change based on #param1 selection.
You will have your main dataset (main_dataset) with a where clause something like this
where sometable.somecolumn = #param1
and sometable.someothercolumn = #param2
Now you create a dataset (param1_dataset) for #param1 which brings back all the values you require for this parameter
Now create another dataset (param2_dataset) form #param2 and add a where clause to it which restricts the returned list.. something like this..
where sometable.somecolumn = #param1
Now on your report parameters.. set the Available Values for each parameter (report parameter properties) to "Get Values from a query" and select the appropriate dataset and the value field and label field (returned by the dataset) for each parameter.
Now when you run your report, your parameter selection 2 should change based on what you selected for parameter selection 1

SSRS "B" Parameter change to default after change in "A" parameter

I have SSRS report with several parameters (based on SSAS cube). All parameters has own default values. For example there are 3 parameters.
At first I change 1st and 3rd parameters to another value. After that I change value of the 2nd parameter. But after that the value of the 3rd parameter changes also - to its default. But the first parameter will stay the same. There is some dependency in order - if I change 2nd parameter, the 3rd parameter will reset itself to default.
Is there any chance to avoid this situation? I want keep the value of the 3rd parameter same as I defined.
There is no connection between those parameters
Thank you for your help
Ondra
On Parameter properties, in advance tab select option as to not refresh, check below screenshot

SSRS multivalue parameter passing

I have a multi value parameter I get from a query. I pass it to my dataset and it works like a champ. The dataset parameter uses join, i.e., =JOIN(Parameters!CodeList.Value,",").
So far so good. However when I pass this to a subreport, the subreport seems to only "get" the first item in the list instead of the string.
Also, if I put a textbox on my main report that looks at the CodeList parameter, i.e., =Parameters!CodeList.Value(0), I just see the first item. Using JOIN here returns an error.
I clearly don't get something here. Any available illumination?:)
How about this ?
=Parameters!CodeList.Value(0) gives you the first selected parameter value
=Parameters!CodeList.Value(1) gives you the second selected parameter value
so on
&
Join(Parameters!CodeList.Value,",")
will give you the all selected value for the parameter seperated by ,
Condition is, parameter should exists lol'z.
Assuming that you want it to behave identically to your dataset in this report (I.E. you want to send a string containing all the values in your parameter separated by a comma), you just need to pass the same thing to the SubReport's parameter:
=JOIN(Parameters!CodeList.Value,",")
If what you actually want is for the Parameter in your SubReport to have the same values as the Parameter in your main report, you need to pass:
=Parameters!CodeList.Value
Note the absence of the (0) at the end. The (0) on the end of it will cause it to pass only the first value in the parameter which isn't what you're after.

How to map a single SSRS parameter to multiple parameters of a stored procedure

I have a Stored procedure in MYSQL contain two date parameters(#FromDate,#ToDate).
See Here my requirement is,
In SSRS it will display one date parameter in preview tab.
when i click date it will display that Date only.
how can i achieve this Scenario?
Can anyone explain briefly?
Regards,
Samba
If you pass a single date to what I presume is a "between" parameter, you will probably get zero rows.
Instead, try this:
Add a date parameter to your SSRS report. We'll call it "c"
Set the "Fromdate" parameter to "Hidden", and set its default value to =Parameters!c.Value
Set the "Todate" paramter to "Hidden", and set its default value to =DATEADD("d",1, Parameters!c.Value) (adjust the time added as needed)
This should allow the user to only see the "c" parameter, while populating the target parameters in a useful way.