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

Group Counter Issue

Status
Not open for further replies.

TimothyP

Programmer
Aug 6, 2002
135
US
I am trying to create a group counter that will reset after each page.

My formula...

whileprintingrecords;
shared numbervar counter;
counter:=counter + 1

is counting suppressed groups. How do I fix this?

Also, where do I put the reset formula to reset to 0 after each page?

Thanks in advance.
Tim
 
Pretty vague.

Where are you using this formula?

How are you suppressing the groups? The reverse logic should be applied for counting valid groups.

Why would groups be counted per page, they can span pages...

You might want to post meaningful technical information rather than trying to describe data and requirements:

Crystal version
Database used
Example data
Expected output

-k
 
As synapsevampire says, groups have no inherent relations with pages.

If you want to do page totals, try something like this:
Code:
Place V_head in the Page Header section and suppress it
//   Clear the total
WhilePrintingRecords;
NumberVar PageTot :=0;

Place V_Item in the whichever section contains the field you want to total
// Accumulate
WhilePrintingRecords;
NumberVar PageTot := PageTot + 1;

Place V_Show in the page footer section
// Show
WhilePrintingRecords;
NumberVar PageTot;

Variables don't need to be shared variables unless a subreport is used.

If you want a count that does not include suppressed groups, you might use a running total which decides whether to add or not based on the same test used for suppression.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top