Solved

Evaluating a empty date field with Crystal Syntax

Posted on 2002-07-11
9
685 Views
Last Modified: 2007-12-19
I am trying to populate a field with one of three values based on this if statement.  Everything seems to evaluate properly except the "{@datecompleted}=Date (0,0,0)".  I thought this was the correct way to check for an empty date field but I guess I am wrong.  Can anyone help me out?

if ({@datecompleted} > {@daterequired}  )
then
"CLate"
Else if{@daysout}>60 and {@datecompleted}=Date (0,0,0)
then
"NLate"
Else
"On Time"
0
Comment
Question by:ccarlson62
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 7146405
ccarlson62

Try one of the following:

Else if {@daysout}>60 and {@datecompleted} <= date(0,0,0)

or this one

Else if {@daysout}>60 and {@datecompleted} <= date(0,0,0,0,0,0)

Depending on your database, you may need to check to see if the date is LESS THAN a null date value instead of EQUAL TO.  You may also need to explicitly null the time components of a date-time variable by including the extra 3 zeros.

DRRYAN3
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 7146950
You might also have to check as

Else if {@daysout}>60 and IsNull({@datecompleted})

mlmcc
0
 

Author Comment

by:ccarlson62
ID: 7149954
Thanks for the suggestions

I Have tried:

Else if {@daysout}>60 and {@datecompleted} <= date(0,0,0)

and this one...

Else if {@daysout}>60 and {@datecompleted} <= date(0,0,0,0,0,0)

and this one....

Else if {@daysout}>60 and IsNull({@datecompleted})

No luck so far, I am upping the points to 100 since this  does not look like it is going to be as simple as I had hoped.

0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 12

Expert Comment

by:DRRYAN3
ID: 7150746
What database is the source of your data and which CR driver are you using to get to it?  Also, what version of CR do you have?
0
 

Author Comment

by:ccarlson62
ID: 7150785
I am using Crystal 8.5

I am using the Notes SQL Driver ver. 3.01

I am going after Data in a Domino Database Domino server ver. 5.0.10
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 7150952
I don't have Domino to test against.  

Perhaps Domino is not storing empty dates as a null value.  I searched the Domino Developer web site without success on this.  What value is in @datecompleted for a record you know to have a null value?

Last question - how have you declared the @datecompleted variable in your Crystal formula?
0
 
LVL 4

Accepted Solution

by:
jsweby earned 100 total points
ID: 7172824
I have successfully used the IsNull test before, however it MUST be the FIRST test done on that field, so intead of

if {@daysout}>60 and IsNull({@datecompleted})

use

if IsNull({@datecompleted}) and {@daysout}>60

J.
0
 
LVL 5

Expert Comment

by:gawilson2000
ID: 7224208
I have had a lot of trouble with null dates before too.

So I just check for:
ToText({@datecompleted}) = ''
0
 
LVL 5

Expert Comment

by:gawilson2000
ID: 7738634
You should be very wary with this solution.  

Another programmer may come along at a later date and add more code at the beginning.

I think that you will find that my code works regardless of the position.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

839 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