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 2005 Forums
 Analysis Server and Reporting Services (2005)
 Field Expression when null

Author  Topic 

DLTaylor
Posting Yak Master

136 Posts

Posted - 2009-12-01 : 12:00:43
I have a field using the following expression;

=
Fields!MinEstDisDate.Value &
" (" &
Fields!MinEstDisDays.Value &
" days)"

Sometimes the Value in the 2 fields are bank\null and the output is
( days) - i would like this to read;

"No data available"

how can i modify the expression to incorporate nulls?
Thanks

JCirocco
Constraint Violating Yak Guru

392 Posts

Posted - 2009-12-01 : 12:57:17
Sorry, from memory and not on PC with syntax check.. Something like?

=Iif(Fields!MinEstDisDays.Value = " ", "No Data Available", Fields!MinEstDisDate.Value & " (" & Fields!MinEstDisDays.Value & " days)")

John
It's a small world (but I wouldn't want to paint it)
Go to Top of Page

DLTaylor
Posting Yak Master

136 Posts

Posted - 2009-12-02 : 04:24:30
Thanks JCirocco,

The 1st part works when the "" has no space;
=Iif(Fields!MinEstDisDays.Value = "", "No Data Available",
Fields!MinEstDisDate.Value & " (" & Fields!MinEstDisDays.Value & " days)")

but the Else part returns an #Error in the field when there should be values...

can anyone help - it will be great to solve this as im having problems learing this syntax.
Thanks


Go to Top of Page

DLTaylor
Posting Yak Master

136 Posts

Posted - 2009-12-02 : 05:14:44
Hi, it works using the following syntax;

=Iif(Fields!MinEstDisDays.Value is nothing, "No Data Available",
Fields!MinEstDisDate.Value & " (" & Fields!MinEstDisDays.Value & " days)")

Thanks
Go to Top of Page

JCirocco
Constraint Violating Yak Guru

392 Posts

Posted - 2009-12-02 : 08:11:27
Sorry, my original example assumed blank and not null. Glad it helped though

John
It's a small world (but I wouldn't want to paint it)
Go to Top of Page
   

- Advertisement -