Null dates in Crystal Reports

Posted on 2006-04-20
Last Modified: 2012-08-13
To make this simple, I have a report with 3 columns. They are start date, end date and a formula field to subtract the start date from the end date to produce the number of days from start to end. This works fine except that there are conditions where the end date has no value and the database returns the date of 12/31/9999. I would like to create a formula that:

Checks for the null date and if it exists, does not perform a calculation but displays something identifying the null value and if the date is valid, perform the date subtraction (end_date - start_date).

I was using something like:

If IsNull (end_date) do something
(end_date - start_date)

Problem is I keep getting an error that Crystal wants a date in the last part of the formula.

Question by:alank2
    LVL 77

    Expert Comment

    Hi alank2,
    THe outcomes of an if statement must be the same datatype.
    So you could do something like:

    If IsNull (end_date)
    end_date - start_date

    Then you could suppress the formula field in the report if the result is 9999

    LVL 42

    Accepted Solution


    You didn't explain what "do something" was but if you prefer a text output then you can do this:

    If IsNull (end_date)
      'Invalid Date'
      CStr(end_date - start_date)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Suggested Solutions

    I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
    Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now