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

Summing a maximum

Status
Not open for further replies.
Mar 31, 2004
113
US
for every call we take there could be any number of visits needed by an engineer to fix the machine. linked to the call table is a thread table which has a visit number. grouping by call number, i'm trying to work out how many visits were needed to fix x number of calls in a period. using maximum(visit number, call no) brings through the visits needed per call but i'm not sure how to summarise this.

 
hi
create a running total
select visit field and used the sum
reset on change of group

Durango122
Remember to used all fingers when waving to policemen :)
 
but that would sum the visits and for a call that has three it would sum to six (1+2+3). i'm trying to just bring out, for example on that one just 3. and the maximum for all and sum them for a specific period
 
Do you mean, you want the number of calls with one visit, the number with two visits etc?

One solution is to write running totals for the whole report, one for maximum 1, another for maximum 2 and so on. I'm not certain whether you can test for a maximum in a running total: try it and see.

Failing that, you could do a subreport, to show the same data in a different way. Wasteful of machine time, but sometimes the best way to get the job done.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
no i dont think that would help. what i have is 9000+ calls. each call has a thread with various information including whether this is realting to the 1st, 2nd or 3rd visit (or more) if a call has 3 visits it will have 3 lines of data, the visit number field will say 1,2 or 3 depending on which it is. grouped by call number for this call i would like to just see a field with 3 in it and then i want to sum this field. eg date below

call no work start date time visit no
123 1/1/05 11.15 1
123 3/1/05 15.30 2
123 7/1/05 09.10 3
MAX = 3
456 15/1/05 12.25 1
456 17/1/05 14.10 2
MAX = 2
789 22/1/05 16.55 1
MAX = 1

So i want to sum the 'MAX' so for this set i would get 6 (3+2+1)
 
Insert a group on {table.callno} and then create two formulas:

//{@summax} to be placed in the group header or footer:
whileprintingrecords;
numbervar summax := summax + maximum({table.visitno},{table.callno});

//{@display} to be placed in the report footer:
whileprintingrecords;
numbervar summax;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top