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

Reset Running Total field on each page...

Status
Not open for further replies.

rjcmbc

MIS
Jun 4, 2004
6
CA
Hi,

Can something provide me with some insight as to how I may reset a 'sum' running total field for EACH page? I originally thought you could use pagenumber change as the flag however crystal says that's a no no.

Also, I have a second issue... one that involves ignoring 'suppressed' duplicate fields in the above sum running total calculation? Or is this even possible??

Thanks in advance.

RJ
 
If you're suppressing duplicate fields, and don't want them summed, then you should remove them from the report using the record selection formula, some details about the data would be useful.

As for a Running Total which resets at each page, roll your own:

Page Header formula:
whileprintingrecords;
numbervar PgTot:=0

Details formula:
whileprintingrecords;
numbervar PgTot:=PgTot+{table.field}

Page Footer formula:
whileprintingrecords;
numbervar PgTot

-k
 
thanks a million 'k' that definitely solved the page by page issue... however, would you happen to know how to NOT sum any duplicate data in a detail row?
 
Sure, change the details formula to something like:

Details formula:
whileprintingrecords;
numbervar PgTot
if previous({table.field}) <> {table.field} then
PgTot:=PgTot+{table.field}

Check to make sure that you're guaranteeing thqat they shouldn't be the same, for instance if you were totaling invoices, amounts could be the same, so you would verify that it is a dupe by using something like:

Details formula:
whileprintingrecords;
numbervar PgTot
if previous({table.field}) <> {table.field}
and
previous({table.invoiceid}) <> {table.invoiceid}
then
PgTot:=PgTot+{table.field}

-k
 
Thanks again K,

Actually just previous to coming back here to see if you'd replied I had come up with a solution very similar to the one you supplied however, I think I went about it the long route instead. I.e. I created formulas for each of the fields that I wanted to sum up using the similar 'previous/next' function comparisons. It worked! Only if I had seen your posting I might have saved some time. Oh well, c'est la vie... but much appreciated regardless!
 
IO had it wrong anyway, should have been:

Details formula:
whileprintingrecords;
numbervar PgTot
if previous({table.field}) <> {table.field}
or
(
previous({table.field}) = {table.field}
and
previous({table.invoiceid}) <> {table.invoiceid}
)
then
PgTot:=PgTot+{table.field}

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top