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

Running total per page, can't get it to work 1

Status
Not open for further replies.

dalec

Programmer
Jul 8, 2000
191
US
I'm using CR 7. and am trying to get totals per page, since there isnt a running total selection for reseting per page, I'm trying to use vars. Except that I'm not getting them to work right, so I need some help.

I created 4 formula fields, the first one I put on the report header with the following: (my variable count the number or employees per page, or suppose to)

global numberVar PgNumEmp := 0;

Then in my page header I added the following formula field:

Global numberVar PgNumEmp := 0;

Then in details I have the formula field:

WhileReadingRecords;
Global NumberVar PgNumEmp;
PgNumEmp := (PgNumEmp + {Hour_Head.Num_Emps})

And lastly to print the total in the page footer:

whileprintingrecords;
numberVar PgNumEmp;


My problem is that when I print the page_footer it gives a complete total of the entire report (it's not resetting at the beginning of each page). Thanks in advance for your help. PS. If I take out the "whileprintingrecords" statement in the page footer I get a zero for the total.


 
Change the whilereadingrecords to whileprintingrecords in the following:

WhileReadingRecords;
Global NumberVar PgNumEmp;
PgNumEmp := (PgNumEmp + {Hour_Head.Num_Emps})

-k
 
Thank you so much for your help, that helped, but, now once the value is set it remains a running total, how can I clear it for the next page. (I'm trying to get just page totals).

thanks
 
It's like it doesnt recognize the code in the page header that should set the vars back to zero?
 
I found that if I put "whileprintingrecords" in my page header formula that it works like I wanted. Thanks, and a star.
 
I seem to recall some page header/footer concerns like that, here's a cheat:

Create a formula of:

if {table.field} <> "ZQifdsagfafn,*##$%" then
"Blah"
else
"Blahblah"

Now group on this field and suppress the group header and use the footer to display the total.

Then right click the group footer and select format section and turn on the new page after.

Now this fake group acts as a page header/footer so place the formulas within those.

Works perfectly for this sort of thing.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top