ssrs-2008ssrs-expression

Hiding (or Displaying) Rows in SSRS Based off a Field Value


I'd like to only display certain rows on my report using SSRS if the field value of EMID=3 or EMID=Null. Or if it would be easier, to hide rows where EMID in (1,2)

I right + clicked the row -> Row Visibility -> Show or Hide Based on an Expression and created this expression:

=IIF(Fields!EMID.Value=1 Or Fields!EMID.Value=2,True,False)

But that does not hide the rows I am looking to hide. Any suggestions on what I did wrong?

Thanks,


Solution

  • Most of the times issue with the SSRS value matching expressions are the data types of the values that creates the problems or undesired result. In your case your EMID field might be coming as the string so you need to make sure that it is convert back to the Int before matching. For that matter always right your expressions in SSRS using type conversion so your expression can be on safer side.

     =IIF(CInt(Fields!EMID.Value)=1 Or CInt(Fields!EMID.Value)= 2,True,False)