Wednesday, March 7, 2012

Expression Data Type Conversion

I am getting the following error in my report. I am tring to program the BackgroungColor Expression so the if the value is null display a blue color else leave it white.

Conversion from string "" to type 'Date' is not valid

Here is my code sample:

=Iif(Fields!ReturnTime.Value = "", "AliceBlue", "White")

Hi RayClark,

You cannot compare a string with a date.
You can do this in several ways here is one:

=IIF(Len(Fields!ReturnTime.Value)=0, "AliceBlue", "White")

Use the length function to check the length of return time. If it is 0 set it to alice blue else set it to white :).

http://jhermiz.googlepages.com|||Thanks that worked great!!!

No comments:

Post a Comment