I'm converting af Crystal report to a MS report. My expression in the Crystal report was like this:
=IIF(Fields!foo.Value Is Nothing and Fields!bar.Value Is Nothing,
0,
IIF(Fields!foo.Value Is Not Nothing and Fields!bar.Value Is Nothing,
Fields!foo.Value,
IIF(Fields!foo.Value Is Nothing and Fields!bar.Value Is Not Nothing,
Fields!bar.Value * -1,
IIF(Fields!foo.Value Is Not Nothing and Fields!bar.Value Is Not Nothing,
Fields!foo.Value,
0
))))
The Not
does not work here, even thought the text is blue.
Can I use Not
or something like !
or do I have to go crazy with IsNothing()
You should be able to simplify your expression to:
IIF(Not Fields!foo.Value Is Nothing,
Fields!foo.Value,
IIF(Not Fields!bar.Value Is Nothing,
Fields!bar.Value * -1,
0))
EDIT: To return foo.Value - bar.Value when neither is null, try:
= IIF(Not Fields!foo.Value Is Nothing, Fields!foo.Value, 0) -
IIF(Not Fields!bar.Value Is Nothing, Fields!bar.Value, 0)