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!

Need help with summing a formula

Status
Not open for further replies.

ncchish

Programmer
Jul 29, 2002
86
US
I need help summing a formula. I'm using CR10. I have 3 formulas; the first 2 are init and eval
formulas. I have these supressed in the GH. The last formula displays the total for each agt_rpt_nbr in the GF. I need a grand total for the @YTDQualProd. Can anyone help with this? I can't sum this formula.

Thanks in advance.

//@Init

WhilePrintingRecords;
NumberVar YTDQualProd;
YTDQualProd := 0;

//@Eval

WhilePrintingRecords;
NumberVar YTDQualProd;
if ({CLASS_CDE} in ['01','02','04','06','07','10','11'])
then YTDQualProd := Sum({@Actual YTD Pap},{AGT_RPT_NBR) else
if ({CLASS_CDE} in ['08','09','12','13','14','15','16','18','19','20','21','22','23','26']) and
Sum({@Actual YTD Pap},{AGT_RPT_NBR}) >= 75000 then
YTDQualProd := Sum({@Actual YTD Pap},{AGT_RPT_NBR})
else YTDQualProd := 0

//@YTDQualProd

WhilePrintingRecords;
NumberVar YTDQualProd;
YTDQualProd;

 
You'll have to do a grand total formula that's similar to your Eval formula that doesn't re-set for each group. Crystal won't let you create a summary on a formula that contains a summary function (sum, count, etc.)

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Just add another variable to your evaluation formula:

WhilePrintingRecords;
NumberVar YTDQualProd;
if ({CLASS_CDE} in ['01','02','04','06','07','10','11'])
then YTDQualProd := Sum({@Actual YTD Pap},{AGT_RPT_NBR) else
if ({CLASS_CDE} in ['08','09','12','13','14','15','16','18','19','20','21','22','23','26']) and
Sum({@Actual YTD Pap},{AGT_RPT_NBR}) >= 75000 then
YTDQualProd := Sum({@Actual YTD Pap},{AGT_RPT_NBR})
else YTDQualProd := 0;
numbervar grtot := grtot + YTDQualProd;

Then create a second display formula--for the report footer:

whileprintingrecords;
numbervar grtot;

-LB
 
Thanks Guys,

This worked perfectly. Thanks Lbass for spelling it out for me. It always helps when you give an example. You are the best!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top