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!

How do I get a grand total for a field with a maximum formula? 1

Status
Not open for further replies.

suefhmis

Instructor
Jan 24, 2002
25
0
0
US
Hi, I'm using CR 8.5 Developer Edition. I'm using the following formula ("Balance") in the Group #2 Footer:

Maximum ({query.balance_due}, {query.sales_contract_nbr})

All I want to do is get a grand total of the formulated field. Is this possible? If so, how? Thanks!
 
hi

in your insert table on the tool bar
click on insert -> grand total

cheers

pgtek
 
I tried to do that. Unfortunately, my formulated field, @Balance, isn't listed as one of the fields for which you can insert a grand total.
 
I get a "The summary / running toal field could not be created" message.
 
You can do this using a 3 formula running total

In the report header and footer (put a copy of the formula in each spot (or create two formulas):
whileprintingrecords;
numbervar addit;

for the GF2;
whileprintingrecords;
numbervar addit:=addit + Maximum ({query.balance_due}, {query.sales_contract_nbr});

Suppress the formula kields in the GF2 and the report header.



Mike
 
Use the 3 formula approach to demonstrate producing totals at the Group 1 level:

Group 1 header:
whileprintingrecords;
numbervar MaxBalDue :=0;

Group 2 Footer:
whileprintingrecords;
numbervar MaxBalDue;
MaxBalDue := MaxBalDue+Maximum ({query.balance_due}, {query.sales_contract_nbr});

Group 1 Footer: // displayed here
whileprintingrecords;
numbervar MaxBalDue

You can alter this to provide a grand total by omitting the GH1 formula and placing the GF1 formula in the report footer.

-k
 
Hi Mike,

I tried it...not sure I did it correctly. I created the following TWO formulas:
"Def Variable" = whileprintingrecords;
numbervar addit;

"GF2" = whileprintingrecords;
numbervar addit:=addit + Maximum({query.balance_due}, {query.sales_contract_nbr});

I put both formulas into the report header and footer and put the GF2 formula into GF2. However, the total of numbervar addit is off by the amount of the very first balance due...did I put something in the wrong place? Or did I skip a step?
 
add this to the beginning of the gf2 formula

evaluateafter({@balance});

Mike
 
You need to remove the GF2 formula from the report footer. This is causing the last value to increment again. Only use the display formula in the report footer:

whileprintingrecords;
numbervar addit;

I think you only need the GF formula in the GF2 and the display formula in the report footer. You don't need to set or reset if your total is for the report as a whole and not at the group level.

-LB
 
synapsevampire,

I bow to you, CR genius. It worked perfectly. Thanks so much.

-s
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top