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

Select Latest Date from several dates 2

Status
Not open for further replies.

danny118088

IS-IT--Management
Jan 20, 2009
4
US
Hi All...

I'm relatively new to Crystal XI report and now facing problem with Dates formula.

Data structure:
PO Number|Creation Dt|Posting Dt|Doc Dt |Released Dt
x 01/01/09 01/15/09 - 03/03/09

From above data sample, I would like to display the latest date only by comparing all 4 fields.

Expected result :
PO Number|Last Updated Dt (from Formula)
x 03/03/09

I'm trying to use DateDiff but it would take long lines to capture all combination. Is there any other way to handle this?

Thank you in advance for the help.

cheers,
D

 
You need DateDiff to find the number of days, or whatever. Crytal will allow you to compare two dates and see which is greater.
Code:
if {Creation Dt} > {Posting Dt}...
Test all possible combinations. No short-cuts, as far as I know.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Convert each of the four fields in a formula like this:

//{@docdt}:
if isnull({table.docdt}) then
date(0,0,0) else
{table.docdt}

Then create a formula like this to do the comparison:

maximum([{@createdt},{@postdt},{@docdt},{@releasedt}])

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top