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

Formula Question 1

Status
Not open for further replies.

buffdaddy619

Technical User
Jan 12, 2010
10
US
I just had a problem getting a formula to present the correct data in the correct a GF and RF and just needed a shove in the right direction on this. It's probably something very minor but I can't seem to put my finger on it.

I can't get my formula to add correctly on GF1 or RF. Any help will be greatly appreciated. Here is an overview:


Preview Level for Dates (1/1 - 1/2)
GH1 Doctor Visits Session
GF2 Dr.A 8 4
GF2 DR. B 5 2
GF1 TOTAL ?
RF GRAND TOTAL ?

I'm having an issue trying to get my TOTAL and GRAND TOTAL to add up correctly. I have 2 formulas set up on this level:

Formulas
1. GF2 Session (Display)
//{@display} to be placed in the report footer (group footer if summary is for a higher order group):
whileprintingrecords;
numbervar sumx;
//this makes up the session count on this level (ex 4,2)

2. GF2 Session (Hidden)
whileprintingrecords;
numbervar sumx;
if not inrepeatedgroupheader then
sumx := 0;


First Drill-Down
GH1 Doctor Dates Visits Session
GF3 Dr.A 1/1/2010 5 2
GF3 Dr.A 1/2/2010 3 2
GF2 Total 8 4

Formulas:

1. GF3 Session = DISTINCTCOUNT({RCPMS_FLASH_RPT_PROC.STATUS2},{RCPMS_FLASH_RPT_PROC.DATES})
//calculates sessions (ex 2,2)

2. GF3 Session (Hidden)
//{@accum} to be placed in the group section containing the calculation:
whileprintingrecords;
numbervar sumx := sumx + {@GF3 Session};

Detailed Section (ON THE 1ST)
GH2 Date Doctor Patient Time Time 2
D 1/1/2010 Dr.A Billy 8:00 AM
D 1/1/2010 Dr.A Jimmy 9:00 AM
D 1/1/2010 Dr.A Alex 10:00 AM
D 1/1/2010 Dr.A John 11:00 AM
D 1/1/2010 Dr.A Frank 1:00 PM


A session is a distinct count of Time2. In this situation Dr. A has 2 (AM + PM) for 1/1/2010
 
Formula #2 belongs in Group HEADER #2.

-LB
 
Thank you for the prompt response lbass.

I have done what you've said and have moved formula 2 from GF2 into GH2:

GF2 Session (Hidden)
//Moved from GF2 to GH2
whileprintingrecords;
numbervar sumx;
if not inrepeatedgroupheader then
sumx := 0;

Now the only formula on GF2 is the following:

GF2 Session (Display)
//{@display} to be placed in the report footer (group footer if summary is for a higher order group):
whileprintingrecords;
numbervar sumx;

This formula represents the session counts in GF2 (the 4,2).

Preview Level for Dates (1/1 - 1/2)

GH1 Doctor Visits Session
GF2 Dr.A 8 4
GF2 DR. B 5 2
GF1 TOTAL ?
RF GRAND TOTAL ?


How should I now go about to obtain the Total in GF1 and the Grand Total in the RF?
 
You have to repeat the logic using two new variables. First change this formula to:

GF3 Session (Hidden)
//{@accum} to be placed in the group section containing the calculation:
whileprintingrecords;
numbervar sumx := sumx + {@GF3 Session};
numbervar sumgrp1 := sumgrp1 + {@GF3 Session};
numbervar sumgt := sumgt + {@GF3 Session};

Add a reset in GH1:
whileprintingrecords;
numbervar sumgrp1;
if not inrepeatedgroupheader then
sumgrp1 := 0;

Add display formulas:

//{@displGF1} to be placed in GF#1:
whileprintingrecords;
numbervar sumgrp1;

//{@displGT} to be placed in the report footer:
whileprintingrecords;
numbervar sumgt;

-LB
 
It worked like a charm. Thanks a bunch LB...you're awesome. I really do appreciate the help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top