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

Date Formula

Status
Not open for further replies.

BradCustom

IS-IT--Management
Oct 5, 2007
296
US
I'm creating a report where I want to find the difference between the last or maximum date entry for a given operation.

The report is grouped by Job number and Workcenter. In the footer I have the following formula to find the maximum {Transaction.Start}

maximum({Transaction_Data.Transaction_Start},{Job_Operation.Work_Center})

What I'd like to do is to find the difference between Workcenter 1 and 2 then workcenter 2 and 3 ect. This would be calculated for each Job and then totaled for the Job. What I'm trying to find is the "Lag" time between Workcenters.

Thanks for your help!
 
Use a formula like this in the workcenter group header or footer:

whileprintingrecords;
datevar curr;
datevar prev := curr;
curr := maximum({Transaction_Data.Transaction_Start},{Job_Operation.Work_Center});
numbervar diff;
numbervar sumdiff;
if onfirstrecord or
{table.job} <> previous({table.job}) then
diff := 0 else
diff := curr - prev;
sumdiff := sumdiff + diff;
diff;

Place a reset formula in the {table.job} group header:

Whileprintingrecords;
numbervar sumdiff;
if not inrepeatedgroupheader then
sumdiff := 0;

Then in the job group footer, use:
Whileprintingrecords;
numbervar sumdiff;

This assumes you have a group #1 on job, and a group #2 on work_center. If the work_center maximums are not in ascending order, you might need to do a group sort on date at the work_center group level.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top