Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Null dates in Crystal Reports

Posted on 2006-04-20
Medium Priority
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

ID: 16499768
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

frodoman earned 2000 total points
ID: 16500473

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)


Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

564 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