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

Totaling the maximum value in report groups

Status
Not open for further replies.

Pete56

Programmer
Aug 29, 2001
39
0
0
US
Product: Crystal 10, ODBC access to foxpro files
Problem: Total therapy days by delivery ticket and patient
Files:
1. Ticket detail with ticket #, from and through date in each line item on the ticket.
2. Patient master linked to ticket file by patient number.
Desired output:
Group # 1 - Patient #1 - 25 days
Group #2 - Ticket 100 - 14 days
Item 1 - 14 days
Item 2 - 14 days
Item 3 - 10 days
Item 4 - 10 days
Group #2 - Ticket 200 - 11 days
Item 1 - 11 days
Item 2 - 11 days

I am using a maximum summary to get the number of days in the group #2 record and want to add them all up by patient but I don't know how to sum this maximum number into higher groups. I've gotten close 2 or three times.

Question: How can you show a total number in group #1 based on an amount in group #2 that is based on the maximum value of a detail field.

Thanks.

Pete
 
You need to use variables to do this, and you will need to display this in the group 1 footer, not the header:

In the group 1 header:
WhilePrintingRecords;
If Not InRepeatedGroupHeader then Numbervar MaxSum:=0

In the group 2 footer:
WhilePrintingRecords;
Numbervar MaxSum:=MaxSum+maximum({yourfield},{TicketNumber})

In the group 1 footer:
WhilePrintingRecords;
Numbervar MaxSum;

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top