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

Find the closest date in past

Status
Not open for further replies.

c8ltgkue

MIS
May 1, 2007
57
GB
Using CR XI

Here is the layout of the report

Case ID HearingDt ResponseDt Dif in days
GH1 0001 01/02/2008
D 12/12/2007 01/02/2008 51
D 26/07/2007 01/02/2008 159

GH1 0002 12/03/2008
D 31/03/2008 12/03/2008 -19
D 15/01/2008 12/03/2008 57
D 28/08/2007 12/03/2008 197

I want to find the closest Hearing Date in the past to the Response Date and show it in the Group header/Footer. From the above example, I would like to pick 12/12/2007 for Case ID 0001 and15/01/2008 for Case ID 0002. I can’t use the minimum function. I know I will have to use variables but can’t figure out the logic. Please help

C8

 
is there a reason for not using minimum

the easiest ways 1. is using summary with minimum
2.running total with minimum
 
Use formulas like this:

//{@reset} for the group header:
whileprintingrecords;
datevar x;
if not inrepeatedgroupheader then
x := date(0,0,0);

//{@accum} to be placed in the detail section:
whileprintingrecords;
datevar x;
if datediff("d",{table.responseDt},{table.hearingDt}) =
minimum(datediff("d",{table.responseDt},{table.hearingDt})) then
x := {table.date};

//{@display} for the group footer:
whileprintingrecords;
datevar x;

-LB
 
Actually change that to:

//{@accum} to be placed in the detail section:
whileprintingrecords;
datevar x;
if datediff("d",{table.responseDt},{table.hearingDt}) =
minimum(datediff("d",{table.responseDt},{table.hearingDt})) then
x := {table.date} else
x := x;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top