Wednesday, March 28, 2012

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_Value is Nothing, "<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 appreciatedCStr to convert
And try this
ISNULL(Fields!Package_Pack_Value)
|||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|||

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 )

sql

No comments:

Post a Comment