Solved

Generating and Printing a page total in Crystal Reports 8.5

Posted on 2004-08-12
7
486 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
  • 3
  • 3
7 Comments
 
LVL 100

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 100

Expert Comment

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

What totals are you getting?

mlmcc
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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 22

Expert Comment

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

Cheers,
- Ido
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 11789994
Glad I could help

mlmcc
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crystal Reports Groups need Hand Cursor on Hover 4 77
Crystal Reports 2008 6 32
Crystal Reports 2013 25 35
Possibly a grouping issue? 7 24
Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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