Solved

Generating and Printing a page total in Crystal Reports 8.5

Posted on 2004-08-12
7
479 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
Comment Utility
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
Comment Utility
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
Comment Utility
No that was a typo on my part.  Good catch.

What totals are you getting?

mlmcc
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

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

Author Comment

by:donalric
Comment Utility
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
Comment Utility
Can you have Null values in your {pap_impt.lodge_amt}?

Cheers,
- Ido
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Glad I could help

mlmcc
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now