Search code examples
filterssrs-2008-r2ssrs-tablixiif-function

IIF Statement in TablixFilter issue


I'm trying to filter a matrix in my report. I have names of 4 drivers and I want the Matrix5 to show the name of a default driver in case SELECT ALL is checked in filter. Otherwise I want the matrix to show whoever is checked.

I set an expression at matrix filter as;

=IIF(Parameters!Sofor.Count=4,"abcdef",Parameters!Sofor.Value)

-abcdef is the name of the default driver for the tablix -Sofor is the driver name parameter and has 4 total possible name options, 5 if we consider SELECT ALL too.

It works well if I check SELECT ALL but stops working if I select only one option.

Error I'm getting is as follow;

"The processing of FilterExpression for the tablix "Tablix5" cannot be performed. Cannot compare data of types System.String and System.Object[]. Please check the data type returned by the FilterExpression"

Though the error sounds pretty self explanatory I still can't understand what I'm doing wrong. Any help please?


Solution

  • Parameters!Sofor.Value is an array of values (the object) because its a multi-select parameter. (what happens when the user chooses 2 drivers?)

    Try

    =IIF(Parameters!Sofor.Count=4,"abcdef",Parameters!Sofor.Value(0))