1

I'm way out of my element with SSRS Expressions. I'm hoping someone could lend me a hand.

I have 2 name fields:

  • ContactName
  • BusinessName

If ContactName is NOT NULL then only use the ContactName. However, if ContactName is NULL and BusinessName is NOT NULL then use the BusinessName.

I tried the following:

    =IIF(NOT
         Fields!ContactName.Value Is Nothing, 
         Fields!ContactName.Value, 
         Fields!BusinessName.Value
        )

However, it isn't picking up when I only have a BusinessName.

What do I need to do to also display the BusinessName when I only have a BusinessName?

Just as an update:

The answer was a combination of the IIF statement and a check to see if the value was also an empty string.

webdad3
  • 8,893
  • 30
  • 121
  • 223
  • 1
    possible duplicate of [SSRS expression replace NULL with another field value](http://stackoverflow.com/questions/19234993/ssrs-expression-replace-null-with-another-field-value) – Anup Agrawal Sep 03 '15 at 23:01
  • Switch ContactName and BusinessName and try `=IIF(ISNOTHING(Fields!ContactName.Value), Fields!BusinessName.Value,Fields!ContactName.Value)` – Anup Agrawal Sep 03 '15 at 23:05

1 Answers1

1

In SSRS, ISNOTHING is a function that requires an argument.

Your expression just needs a little change to put your field in the argument:

 =IIF(NOT ISNOTHING(Fields!ContactName.Value), 
         Fields!ContactName.Value, 
         Fields!BusinessName.Value
        )
Hannover Fist
  • 10,393
  • 1
  • 18
  • 39