I don't understand why is nothing is always evaluated to false

The following in one textbox of my report is always evaluated to false when the field package_pack_value and give an error in the str conversion function that follow saying the 'number' is nothing.


= iif ( Fields!Package_Pack_ValueisNothing, "<Null>", Str ( Fields!Package_Pack_Value.Value ) & " " & Fields!Package_Pack_Unit.Value )

I have read all the forum and search a whole day but nothing...

Maybe is the answer very stupid...

If anyone can help me it would be appreciated

[788 byte] By [ThierryNenin] at [2007-12-16]
# 1
CStr to convert
And try this
ISNULL(Fields!Package_Pack_Value)
VectorR3 at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Reporting Services...
# 2
IsNull is not defined in the Micorsoft.VisualBasic namespace and it give compiling error tryng to use it.

But you give me a part of the answer using CStr :


= iif ( CSTR(Fields!Package_Pack_Value.Value) = "", "<null>", CStr ( Fields!Package_Pack_Value.Value ) & " " & Fields!Package_Pack_Unit.Value )

This give well "<null>" when Fields!Package_Pack_Unit.Value is null.

Thank To you VectorR3

ThierryNenin at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Reporting Services...
# 3

You need to use IsNothing(). We convert nulls to empty objects. Does this not work?

=iif ( IsNothing(Fields!Package_Pack_Value.Value), "<null>", CStr ( Fields!Package_Pack_Value.Value ) & " " & Fields!Package_Pack_Unit.Value )

BrianWelcker at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Reporting Services...

SQL Server

Site Classified