Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to I set a "date" field to null? 1

Status
Not open for further replies.

itprsn

MIS
Jan 6, 2004
40
US
In the detail section I have something along these lines:
if part = "1100" and flag_closed = "y" then date_closed else _______ - what I need here is a null if that's possible. The only thing that seems to work is placing date('01/01/01') in this spot but I really need a blank field instead.

Further down in the subtotal area I'm using a maximum(date_closed) so if there's no other date info from the detail I get "01/01/01" as the maximum date which is obviously incorrect. How can I get around this? What is the correct logic to set a "date" field to null? Thanks...
 
A null and a blank field are not the same.

Fields are null if they are stored in the database as null.

Many databases do NOT store dates as nulls, hence you'll get a date.

The solution to your problem can be addressed in different ways, but you didn't share anything about your Crystal version, database used, data, etc.

Here's a quick and dirty solution that should work for any version:

if part = "1100" and flag_closed = "y" then totext(date_closed) else ""

Now when you're displaying your maximum, use:

if max(date_closed) > cdate(1950,1,1) then
totext(max(date_closed))
else
""

That should work depending upon what's in the date field, you may have to adjust the year.

-k
 
thanks for your help, I'll give that a try...
 
Date(0,0,0) will give you a blank field and is of date datatype.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top