Skip to main content

Null values and date formats

Comments

3 comments

  • Permanently deleted user

    Hi Bryan,

    How are you obtaining your date?  Sometimes when we have a date in a report, it is actually a string, so you may be converting the literal string "1/15/2001 12:00:00" into another string.

    You should be able to add another text field or label that uses REVISED.GetType().ToString() as its source, which will display the data type of the REVISED field.

    0
  • Bryan Lynn

    Value is coming back as a System.DateTime

    I get the following formula to work as expected:

    REVISED != System.DBNull.Value ? "Not Null" : "Is Null"

    The following also works but returns the entire date time string (i.e. 8/1/2011 12:00:00 AM):

    REVISED != System.DBNull.Value ? REVISED : "Is Null"

    However, as soon as I try to format the date string I get an error for NULL values:

    REVISED != System.DBNull.Value ? REVISED.ToString("d") : "Is Null"

    Any other suggestions?

    0
  • Permanently deleted user

    The problem is that all three of the elements of that statement get evaluated regardless of whether the test works out to true or false. So even though you aren't trying to format the string when it is null, and you aren't going to use the output of that statement, the statement is evaluated anyway and throws an error.

    There is a workaround for this behavior detailed in this thread:

    http://support.geocortex.com/SupportForums/Thread.aspx?pageid=0&mid=2&ItemID=2&thread=46159

    0

Please sign in to leave a comment.