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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pagewise summing

Status
Not open for further replies.

spramila

Programmer
Sep 15, 2003
3
IN
Hi

I need a help.
My problem is
I am having different group.Each Group we are having one or more pages.We are having the amount field.
Each page we wants to find the sum(amount) and display the result on group footer.like below

Group Footer 1
Page 1 sum amount : 1000
Page 2 sum amount : 5000
Page 3 sum amount : 6000

Total 12000

Group Footer 2
Page 1 sum amount : 2000
Page 2 sum amount : 4000
Page 3 sum amount : 6000

Total 12000


 
For Crystal 8.5, you need something like this:

In the page header:
WhilePrintingRecords;
Numbervar PTotal:=0;

In the detail section:
WhilePrintingRecords;
Numbervar PTotal:= PTotal+{Your.Field};

In the page footer
WhilePrintingRecords;
Numbervar PTotal;

use Currencyvar if you want to find a currency total.

Then do a total for the group, regardless of page. Running totals or Sum will do this.

You can also right-click for [Format Section] for the group footer, and select 'New Page After'.

Madawc Williams
East Anglia, Great Britain
 
for one page we can do like that.but more than one page for group what we will do.
 
Clear in the group header rather than the page header

Madawc Williams
East Anglia, Great Britain
 
Hi Willy

My requirement is I wants to display the each page summary result in Group footer.

Ex1:
Group Footer 1
Page 1 sum amount : 1000
Page 2 sum amount : 5000
Page 3 sum amount : 6000
 
I think you would have to create three formulas for each summary as follows:

{@page1reset} to be placed in the GROUP header:

whileprintingrecords;
numbervar page1tot := 0;

{@page1tot} to be placed in the details section:

whileprintingrecords;
numbervar page1tot;

if pagenumber = 1 then page1tot := page1tot + {table.amount} else page1tot := page1tot;

{@displaypage1tot} to be placed in the page footer and in the group footer:

whileprintingrecords;
numbervar page1tot;

Repeat the above formulas for each summary, substituting the pagenumber for the "1", up to the maximum number of pages per group.

Be sure to go to format section->group footer and check "reset page number after" so that the formulas will work on subsequent groups. If the page numbers vary per group, you could do a conditional field suppression on the display formula so that it won't print if the value = 0. Go to format field->suppress and enter:

{@displaypage3tot} = 0

Since the reset formula is in the group header section, the group must not be set for "repeat header on each page." To substitute for the group header, you could place the groupname in the page header, since I'm assuming you will have set a "new page before" on each group so that each page only has one group instance.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top