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!

Counter Initialization Problem

Status
Not open for further replies.

TEM3

Technical User
Dec 6, 2004
324
US
Using Crystal Reports 8.5.....

I have a counter that counts two items within a Grouping. My initialization formula is:

Shared Numbervar PGCount;
Shared Numbervar CGCount;

PGCount := 0;
CGCount := 0;

I have placed that in the header of Group 2 suppressed and as long as the Group 2 listing does not go to the next page, my totals are accurate. However if the Group continues onto another page, my counts are reset. Is there another way to do this or another place to put my counter??

My counting formula is:

Shared Numbervar CGCount;
Shared Numbervar PGCount;
whileprintingrecords;
if {@Pending} = "Pending" then PGCount := PGCount + 1 else CGCount := CGCount + 1

 
Right click on the Group Header (in the grey area) and choose Change Group or go to Report/Change Group Expert... and choose your group and click the Options button. Uncheck the "Report Group Heade on Each Page" option.



Mike
 
Change your initialization formula to:

Shared Numbervar PGCount;
Shared Numbervar CGCount;

if not inrepeatedgroupheader then(
PGCount := 0;
CGCount := 0
);

Also, shared variables are only necessary for sharing between subreports or between main and subreport, so if you are not using subreports, you can just use "numbervar".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top