Search code examples
ssrs-2012

SSRS Parameter hidden expression error while hiding the tablix


I am getting below error . When I am hiding using parameter from hidden expression.

Expression:=IIF(Parameters!BU.Value="BU5",False,True)
[The Hidden expression for the tablix ‘BU’ contains an error: Overload resolution failed because no Public '=' can be called with these arguments:
    'Public Shared Operator =(a As String, b As String) As Boolean':
        Argument matching parameter 'a' cannot convert from 'Object()' to 'String'. (rsRuntimeErrorInExpression)][1]

enter image description here

Please help to solve this issue.Thanks in Advance.


Solution

  • Looks like BU is a multi-valued parameter. If you want to compare the parameter value to a string directly, you will have to change it to only allow a single selection; otherwise you are comparing an array to a string, which is what your error message indicates.

    Another option is to use the JOIN function to create a concatenated list of the selections to compare against in your expression. For example, you could hide a column if 'BK5' is not selected in the BU parameter by setting the column's visibility expression as follows:

    =INSTR("|" & JOIN(Parameters!BU.Value,"|") & "|","|BK5|")=0
    

    Keep in mind that if you use this method, best practice dictates that you should pick a delimiter that you do not expect to appear in the available values for the parameter, so proceed at your own risk in that regard.