Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 IIf Statement with mixed results

Author  Topic 

moxioron
Starting Member

2 Posts

Posted - 2013-07-29 : 18:17:15
Hello.

My expression:

=iif(Fields!MMRValue.value="","N/A",Fields!MMRValue.value)

If the field in the table is null I get the N/A. However, if the field is not null I get #error.

Where am I going astray? Thank you!

MuMu88
Aged Yak Warrior

549 Posts

Posted - 2013-07-29 : 18:54:40
What is the data type of the field MMRValue ?

You can try one of the following:

1. You can change your dataset and modify the select statement to COALESCE(MMRValue, 'N/A');
OR
2. = iif(Fields!MMRValue.value= 0,"N/A",Fields!MMRValue.value)
Go to Top of Page

moxioron
Starting Member

2 Posts

Posted - 2013-07-29 : 19:10:08
thanks for your response.

It is a currency field. We used = iif(Fields!MMRValue.value>0,"N/A",Fields!MMRValue.value)and it worked.
Go to Top of Page
   

- Advertisement -