Lisa Bruce
Lisa Bruce

Reputation: 3

How to hide a row in ssrs using a multi select parameter

I need to be able to conditionally hide a row in SSRS 2005 based on a Multi Select Parameter. I need to be able to hide the row if the multi parameter = "CS", but if the Multi select Parameter is "CS" and "Sales" then I need to see the row. I've tried this formula:

=IIf((Parameters!Level_4.Value(0) = "CS"
And Parameters!Level_4.Value(0) = "Sales"),false ,True)
=IIF((Parameters!Level_4.Value(0) = "CS"), True, False)

But it does not work...

Upvotes: 0

Views: 614

Answers (1)

alejandro zuleta
alejandro zuleta

Reputation: 14108

Try this:

=Switch(
Array.IndexOf(Parameters!Level_4.Value, "CS")>-1 AND
Array.IndexOf(Parameters!Level_4.Value, "Sales")>-1,false,
Array.IndexOf(Parameters!Level_4.Value, "CS")>-1,true
)

Note multivalued parameters can contain one or multiple values which are stored in an array data type. So if you select a value in your report it will be stored in the 0 index of the array, if you select one more value it will be stored in the 1 index and so on.

Example: "CS" value is stored in Level_4.Value(0) and "Sales" is stored in Level_4.Value(1).

The expression I proposed will check if both values were selected and return true in that case, otherwise if only "CS" is selected it will return false.

UPDATE: Alternative to IndexOf support

=Switch(
InStr(Join(Parameters!Level_4.Value, ","),"CS")>0 AND
InStr(Join(Parameters!Level_4.Value, ","),"Sales")>0,false,
InStr(Join(Parameters!Level_4.Value, ","),"CS")>0,true
)

Let me know if this helps.

Upvotes: 1

Related Questions