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

Problems with Difference Calculation in a group footer section

Status
Not open for further replies.

mellicks

Programmer
Aug 27, 2008
11
US
I am having trouble getting a calculation to work. I'm trying to get the difference between two columns. The two colums are in a GF3 section. The first column is from a summary (Minimum of apptmt_t.appt_time) to get the starting time of the doctor's day. The second column is from a summary (Maximum of apptmt_t.appt_time) to get the ending time of the doctor's day. I'm trying to get the difference between these two fields to evaluate if the doctor was in for a full day or a half day. If the difference is greater than 330, then I want a new field to show a 1. If it's less that 330, then I want it to show .5 (for half day). Then I was planning on totaling this new field in the Group Footer 2 section to show the total days a doctor has worked for the month. Is it possible to do a calculation of fields in a group footer 3 section?

 
You would set up the difference like this:

//{@diff}:
numbervar diff := datediff("n",minimum({apptmt_t.appt_time},{table.doctor}),
maximum({apptmt_t.appt_time},{table.doctor}));
if diff >= 330 then 1 else .5 //decide whether this should be >=

Then use a set of formulas like this to get the total days in GF2:

//{@reset} to be placed in the GH2 header:
whileprintingrecords;
numbervar days;
if not inrepeatedgroupheader then
days := 0;

//{@accum} to be placed in GH3 or GF3 and suppressed:
whileprintingrecords;
numbervar days := days + {@diff};

//{@display} to be placed in GF2:
whileprintingrecords;
numbervar days;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top