Solved

Generating and Printing a page total in Crystal Reports 8.5

Posted on 2004-08-12
7
497 Views
Last Modified: 2008-02-01
I am designing a report that requires that, for each page, the sum of a specified column is to be displayed at the end of the column before going on to the next page. For each page the total displayed should be sum of the column values on that page.

There is also a requirement that the same total at the end of the page be displayed at the top of the next page.

How do I achieve this?

example:

------Page 1------------
previous page total: 0
chq_amt
100.25
50.25
58.50
20.75
20.25
current page total: 250

----Page2--------
previous page total: 250
chq_amt
10.50
18.25
100.75
20.50
50.00
current page total: 200
etc.




0
Comment
Question by:donalric
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 500 total points
ID: 11785351
Create several formulas.  I don't have CR here so the syntax may be slightly wrong.

In the report header
Name - VarDecls
whileprintingrecords;
global numbervar CurrentPageTotal := 0;
global numbervar PrevPageTotal := 0;

In the page header
Name - ResetCurrentPageTotal
whileprintingrecords;
global CurrentPageTotal := 0;
PrevPageTotal;

In the detail section (supress it)
Name - Total
whileprintingrecords;
global CurrentPageTotal := CurrentPageTotal + {Table.DatabaseField};

In the page footer
Name - SetPrevPageTotal
whileprintingrecords;
global PrevPageTotal := CurrentPageTotal;
CurrentPageTotal


Placement
Page Header
TextBox                           Formula
previous page total:  {@ResetCurrentPageTotal}

Page Footer
current page total:    {@PrevPageTotal}


mlmcc
0
 

Author Comment

by:donalric
ID: 11788083
I created the formula and placed the stuff on the page but The figures are out.

This is what I have:
//{@VarDecls} in report header
whileprintingrecords;
global numbervar CurrentPageTotal := 0;
global numbervar PrevPageTotal := 0;
// This formula is placed in the report header


//{@resetCurrentPageTotal} This is placed in the page header
whileprintingrecords;
global numbervar CurrentPageTotal := 0;
global numbervar PrevPageTotal;


//{@Total} This  is placed in the detail section
whileprintingrecords;
global numbervar CurrentPageTotal := CurrentPageTotal + {pap_impt.lodge_amt};


//{@SetPrevPageTotal} This is placed in the page footer
whileprintingrecords;
global  numbervar PrevPageTotal := global numbervar CurrentPageTotal;
global numbervar CurrentPageTotal



You said that I should put {@PrevPageTotal} in the page footer but I put {@SetPrevPageTotal} instead as I didn't create a {@PrevPageTotal} function.  could this be the problem
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 11788155
No that was a typo on my part.  Good catch.

What totals are you getting?

mlmcc
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:donalric
ID: 11788484
How could I email you the report.  probable that would be the best thing.
0
 

Author Comment

by:donalric
ID: 11788960
Sorry, it was my bad.  I placed {@Total} in the wrong section.  I placed it in a group rather than in the detail section.
0
 
LVL 23

Expert Comment

by:Ido Millet
ID: 11788974
Can you have Null values in your {pap_impt.lodge_amt}?

Cheers,
- Ido
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 11789994
Glad I could help

mlmcc
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question