1
votes

I have the following switch statement within an SSRS report, but it errors out when I run the report.

Basically Parameter 1 is a multi value parameter, and when the parameter has two values selected where they are two distinct values, I want a certain text to appear.

=SWITCH(Parameters!Parameter1.Count = 2 AND Parameters!Parameter1.Value(0) = "TEXT1-NY" AND Parameters!Parameter1.Value(1) =  "TEXT2-LA" , "Combined (NY & LA)"
, True, JOIN(Parameters!Parameter1.Label,"& ")
)

Additionally, regardless of the numbers that are selected (i.e if there were 6 parameters that were selected), is it possible that these two parameters would be replaced with that particular text followed by , and then names of other parameter values?

1

1 Answers

0
votes

First of all, good job working out the expression that you have. You're on the right track, but expressions don't have a programmatic way to loop through the values of the parameter.

One option to do specifically what you asked would be to add a custom function to the Code section of your report that could loop through the parameter values.

Another option would be to simply UNION this "Combined (NY & LA)" value to your dataset so that it is available as one of the options.