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

problem with summing a formula 1

Status
Not open for further replies.

sorchard2000

Technical User
Aug 3, 2004
57
US
I am finishing up a Crystal 8.5 report and have a formula called @TotalPtCharge (see following) that show currency charge for a patient bill. This formula resides in a group footer on the main report.

{@MainFormula}+{@MainFormula2}+Sum ({@editedChargeAmt}, {casemain.pat_acct_num})

@MainFormula and @MainFormula2 are references to formulas that are coming off of 2 different subreports.

I need to do a grand total of this formula for all patients listed. But whenever I try to do a Insert>Grand Total OR Insert>Summary OR a running total, the formula is not listed (recognized) as a field. I'm not sure what to do at this point--another formula?
Please help!
Thanks in advance!

sorchard2000
 
You are going to need to manually accumuate the patients totals.

Modify your Group Footer formula to this:
Code:
whileprintingrecords;
local currencyvar patient_total := {@MainFormula}+{@MainFormula2}+Sum ({@editedChargeAmt}, {casemain.pat_acct_num});
currencyvar grand_total := grand_total + patient_total;
patient_total

Create a new formula to display the grand_total variable:
Code:
whileprintingrecords;
currencyvar grand_total;

Place the formula in your report footer.


~Brian
 
When posting issues with a formula, you should display the contents of all formulas used within the formula. {@MainFormula} and {@MainFormula2} must contain references to shared variables created within the subreports. If they do, then you should be able to create a formula to be placed in the group footer:

//{@accum}:
whileprintingrecords;
numbervar grtot := grtot + {@footerformula};

//where {@footerformula} = {@MainFormula}+{@MainFormula2}
// + Sum ({@editedChargeAmt}, {casemain.pat_acct_num})

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

-LB

 
Thanks bdreed35 !
Your solution worked!!!
Thank you so much!

sorchard2000
 
dbreed35:
I have successfully used your formulas to create subtotals for each pt's charges but now I need to make a grand total for all of those subtotals. I tried several variations on your previously posted formulas-without success. Do you have any other advice for me?
I really appreciate your help!

sorchard2000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top