Consider this SSRS value expression :
=IIF(First(Fields!MyCol.Value, "MyDataSet")=0, "yes", "no")
MyCol is a Nullable column. I want “yes” to be output only when MyCol equals 0. The code above correctly evaluates to “yes” when MyCol is 0. However, it also evaluates to “yes” when MyCol is Nothing (i.e. NULL in SQL Server). Is this expected behavior ?
I had to resort to the following longer expression to get the desired result :
=IIF(Not(First(Fields!MyCol.Value, "MyDataSet") is Nothing) And First(Fields!MyCol.Value, "MyDataSet")=0, "yes", "no")
Is there a shorter version of this which also works ?
It looks like this is just due to how VB.NET works, and not caused by anything SSRS is doing.
e.g. here is some straight VB.NET code :
This displays both messages when run.