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!

Grand total On LAST PAGE? (Urgent PLZ) 1

Status
Not open for further replies.

longfellow

IS-IT--Management
Mar 28, 2002
75
IN
How do i get a grand total on the last page of my report after using the following formulas for page totals?


reset formula:

//reset
WhilePrintingRecords;
shared numbervar total := 0


accum formula:

//accum
WhilePrintingRecords;
shared numbervar total := total + {table.numberfield};

display formula:

//display
WhilePrintingRecords;
Shared numbervar total;
Total

Placements

Place the formula field reset in the page header. Right-click on it, pick “format” and then pick the common tab. Pick “suppress”.

Place the formula field accum in the details section. Right-click on it, pick “format” and then pick the common tab. Pick “suppress”.

Place the formula field display in the page footer. Position and format it as required.

I have used the above formulas to get page totals. Now how do i get a grand total on the last page if my report has 8 pages.
 
Maybe like:

//reset
WhilePrintingRecords;
shared numbervar total := 0

accum formula:

//accum
WhilePrintingRecords;
shared numbervar total := total + {table.numberfield};
shared numbervar Grandtotal := Grandtotal + {table.numberfield};
display formula:

//display
WhilePrintingRecords;
Shared numbervar total;
Total

//display Last
OnLastRecord
Shared numbervar Grandtotal;
GrandTotal

But I use Crystal Reports .Net so it's a little different. Also I thought formualas won't be evaluated if suppressed? I always just set them to white.
 
Its in VB6 and where should i put the display last formula? IS it on the last page if so in which section?
 
Put it in the report footer.

There is no last section page in crystal, there's the report footer.

-k
 
For your grand total display formula, I think you'll need to add "whileprintingrecords;", as in:

//{@grtotaldisplay} to be placed in the report footer:
whileprintingrecords;
numbervar grandtotal;

Unless you are using subreports, you don't need to set these up as shared variables (although it won't hurt either if you have no subreports present). If you don't want to change the formulas, then to be consistent, the display formula I just mentioned should be changed to:

//{@grtotaldisplay} to be placed in the report footer:
whileprintingrecords;
shared numbervar grandtotal;

-LB
 
If all you want is a grand total, why can't you right click on {table.numberfield} and select Insert - Summary?
 
I require a grand total as well as a page total. Yes i have done {table.numberfield} and select Insert - Summary?
What should i do to get a continuous page total
 
The original post told how you are getting your page totals. I thought your question was how to get the grand total. Perhaps I am not understanding.
 
No the page total should change from the second page that is the previous pages total also should get added to the current page total
 
As synapsevampire said earlier, Crystal gives you a Report Footer for free. Is there a problem with using it?

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
If you want your page total to be cumulative, then delete the reset field from the page header. Now the page total will get bigger on each page. If you want BOTH a single page total and a cumulative page total you will need two variables.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- TEK2(AT)kenhamady.com
 
//display Last
OnLastRecord
Shared numbervar Grandtotal;
GrandTotal

When i used this formula while definig it i got an error "The remaining text does not appear to be part of the formula"
Whats wrong Can anyone help me?
 
longfellow,

WhilePrintingRecords;
Shared Numbervar Grandtotal;

Is all you need for the formula. This assumes that you have the formula in the details section that is accumulating the variable properly.




Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
askdon@srhconsulting.com
 
Hi Ken

You said
"If you want BOTH a single page total and a cumulative page total you will need two variables. "

How do i use 2 variables or where do i use them can you explain?

Thank you
Longfellow
 
The first response from LikePork is an example of using 2 separate variables, and only resetting one of them.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- TEK2(AT)kenhamady.com
 
Likepork,

Suppressed formulas are evaluated, however suppressed subreports are not.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
askdon@srhconsulting.com
 
when i use the formulas

accum formula:

//accum ----------- Used in Details section
WhilePrintingRecords;
shared numbervar total := total + {table.numberfield};
shared numbervar Grandtotal := Grandtotal + {table.numberfield};
display formula:

//display ---------------- Used in Page footer
WhilePrintingRecords;
Shared numbervar total;
Total

//display Last -------------- Used in Report footer
OnLastRecord
Shared numbervar Grandtotal;
GrandTotal

Now i have a problem. On the last page of the report the grandtotal is displayed twice. How do i suppress either one so asonly one grand total is displayed.

Any ideas.

Longfellow
 
Right click the Page footer formual and select format field->:common->X 2 next to Suppress and place:

onlastrecord

-k
 

Thanks for the input ,my grand total is appearing fine at the end of the report

Thank you all once again

Longfellow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top