I'm linking 2 multi-value parameters together. So that when the user chooses "1" for Fields.P1.Label(0), I get "1" for Fields.P2.Label(0), "2" for Fields.P1.Label(0), I get "2" for Fields.P2.Label(0), etc.
I made it work with the following switch function that I attributed to the Parameters!P2 default value(s):
=Switch(Trim(CStr(Parameters!P1.Label(0)))="1",
"[Episode].&[1]",
Trim(CStr(Parameters!P1.Label(0)))="2",
"[Episode].&[2]",
[and so on for my other 3 possible options])
It works just fine as long as the user checks off the same number of values for my multi-value P1 parameter as the number set as default for P2 (ex.: if P2 has 5 default values set, I must check off 5 values on P1 or I get an error) This is my problem. My user could decide to only choose 1 value, 2 or even 5. So, I created a total of 5 default values for Parameter!P2 by simply copy/pasting the same code but changing Parameters!P1.Label(0)
to Parameters!P1.Label(1)
, Parameters!P1.Label(2)
, and so on up to Parameters!P1.Label(4)
.
Here is where I get my problem, since now, if I don't choose 5 values for my P1 I get an error message... I tried fixing it by addiing switch and isnothing to my P2 default values 2 to 5, but I get another error message instead:
=IIF(IsNothing(Parameters!1.Label(1)), Nothing,
Switch([same code as above]
Long story short, regardless of whether P1 has 1 or 5 values chosen, I need to set my P2 so that it auto-fills the corresponding values from P1. Any suggestions? Thanks!