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

Subtotal of a whileprinting records formula

Status
Not open for further replies.

lab00

MIS
Nov 19, 2003
8
US
Crystal 10
SQL database

I am creating a surgery turn-around-time report so I have to calculate the time between the stop of a case to start of next case. I need to create an avg TAT per OR_Room for each date in my report. My report is grouped by OR Room, Case_date, and sorted by start time.

I am getting the case-specific TAT with:

whileprintingrecords;
numbervar CaseTAT:=
if ({c_newor_cases.or_room}=previous{c_newor_cases.or_room})
and {@CaseDATE}=previous({@CaseDATE}))
then datediff("n",{@PrevStopDTime},{@StartDTime})
This part is working fine.

Then I set up a variable to give me a running total of the TATs:
whileprintingrecords;
numbervar RoomDateTAT:=RoomDateTAT+{@CaseTAT}

I reset @RoomDateTAT in Group2 (Date) header and this is working fine.

What I can't get to work is to get the sum or final subtotal into the group footer.


My data for 1 room for one day would be

CaseTAT RoomDateTAT
24 24
26 50
12 62

What I need is to get the 62 in the group 2 (date) footer. If I add it to the group 2 footer as is I get 74. It's adding the last CaseTAT to the subtotal again (62+12)

Can anyone tell me what I'm doing wrong>
 
You have to create a separate display formula for the footer:

whileprintingrecords;
numbervar RoomDateTAT;

If you used the accumulation formula instead, it would add the last value in the group to the total again.

-LB
 
Worked perfectly. I knew there was something I was missing. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top