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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to suppress a date prior to Dec 31, 1899

Status
Not open for further replies.

iwm

Programmer
Feb 7, 2001
55
US
The client does not want to see dates prior to Dec. 31, 1899.

I used the Format Editor to suppress the date prior to Dec. 31, 1899:

{Reference.beginDate}< 'Dec 31, 1899'

This formula works except when the date is April 01, 2011.

It suppress the date when the date is April 01, 2011. Why does it suppress April 01, 2011? This date is not prior to Dec. 31, 1899.

The data type of this field is STRING.

Your assistance troubleshooting this issue is tremendously appreciated.


Ingrid
 
Its because its a string and in alphanumeic sorts April 01, 2011 is less than Dec 31 1899

Try

cdate({Reference.beginDate})< date(1899, 12, 31)

However, this will be slow as it report will bring back all records and then filter them in report as Crystal can not parse
this formula to SQL

Ian
 
iwm,

If the string is of standard formatting (ie the year is always the last 4 characters), you could also consider something the following:

Code:
Right(Trim({Reference.beginDate}),4)>="1900"

or perhaps

Code:
ToNumber(Right(Trim({Reference.beginDate}),4))>=1900

I do not have Crystal infront of me this morning, but I beleive these should work.

Hope this helps!


Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top