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!

Minimum Function in Running Total

Status
Not open for further replies.

dazum

Technical User
Apr 6, 2011
57
US
I have two dates that need to be compared. Below is the data;

Person ID Start Date Legal Date
609486 10-23-10 3-25-11
609486 2-1-08 10-25-10
609486 7-16-07 4-6-09

I need to get the next Legal Date (10-25-10) that is greater than the maximum Start Date (10-23-10). I've tried using the minimum function and a formula (Legal Date > Start Date) in a Running Total, but the Running Total comes out as 3-25-11. I can get Maximum Start Date in a Running Total, but don't know a way to use it in formula to get a result for the Legal Date of 10-25-10. Any suggestions would be helpful.
 
Records must be sorted in descending order by start date.

//{@groupheader formula:
whileprintingrecords;
datevar minlegal;
if not inrepeatedgroupheader then
minlegal := date(0,0,0);

//{@detail formula} to be suppressed:
whileprintingrecords;
datevar maxstart := maximum({table.start},{table.personID});
datevar minlegal;
if {table.legaldate} > maxstart then
minlegal := {table.legaldate};
if {table.legaldate} > maxstart and
{table.legaldate} < minlegal then
minlegal := {table.legaldate};

//{@groupfooter formula:
whileprintingrecords;
datevar minlegal;

-LB
 
Thanks lbass! It worked on the first try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top