Solved

Evaluating a empty date field with Crystal Syntax

Posted on 2002-07-11
9
683 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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