Reputation: 1138
I'm trying to add a calculated field in a dataset with the following formula:
=iif(Fields!Stocabil.Value,Fields!ValoareFacturat.Value,0)
but using this formula, I'm not getting 0 values on false condition (Stocabil field is boolean), it's returning null probably. I found a workaround that resolve my problem but I really don't like it. The workaround is to replace 0 with a math calculation between fields that will always be 0.
=iif(Fields!Stocabil.Value,Fields!ValoareFacturat.Value,Fields!ValoareFacturat.Value-Fields!ValoareFacturat.Value)
Is there an explanation for this? Thank you
Upvotes: 0
Views: 2246
Reputation: 2962
=iif(IIF(IsNothing(Fields!Stocabil.Value),False,Fields!Stocabil.Value),Fields!ValoareFacturat.Value,0)
Upvotes: 0
Reputation: 38238
As I said, I can't reproduce your problem, and I can't see why what you've done shouldn't work. As discussed in the comments, though, a workaround is to use CDbl()
, which will force the value to a double, and should display a zero for you.
Upvotes: 1