Solved

Evaluating a empty date field with Crystal Syntax

Posted on 2002-07-11
9
680 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
Comment Utility
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
Comment Utility
You might also have to check as

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

mlmcc
0
 

Author Comment

by:ccarlson62
Comment Utility
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
 
LVL 12

Expert Comment

by:DRRYAN3
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:ccarlson62
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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. …
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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