Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: How to count row per page? Post Reply Post New Topic
Author Message
nebchill26
Newbie
Newbie


Joined: 06 Nov 2008
Location: Philippines
Online Status: Offline
Posts: 20
Quote nebchill26 Replybullet Topic: How to count row per page?
     Posted: 28 Jun 2011 at 10:34pm
Hello does anyone know how to count the rows per page?
A sample here is like this

1st Page
Name                              Sex
Edward                             M
Blade                                M
Bella                                 F

Count how many M and F in every page
i want to output Male: 2 and Female:1 in the page footer...
Your help will be greatly appreciated!
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 29 Jun 2011 at 4:47am
Use the three-formula running total technique.

First Formula: Initialize Formula:
whileprintingrecords;
global numbervar nMaleCount:=0;
global numbervar nFemaleCount:=0;

Second Formula: Calculation Formula:
whileprintingrecords;
global numbervar nMaleCount:= nMaleCount + (if {table.sexfield}='M' then 1 else 0);
global numbervar nFemaleCount:=nFemaleCount + (if {table.sexfield}='F' then 1 else 0);

Third Formula: Display Formula (Male):
whileprintingrecords;
'Male: ' & global numbervar nMaleCount

Fourth Formula: Display Formula (Female):
whileprintingrecords;
'Female: ' & global numbervar nFemaleCount

Place the Initialize Formula on a page header, the Calculate Formula on the detail line that has the {table.sex} field, and the Display Formulas in your page footer.
|< /\ '][' ( )
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum