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

Group Count

Status
Not open for further replies.

wolverine3535

Technical User
Joined
Jun 30, 2005
Messages
1
Location
US
I have a db that contains the following info.

Bills BillType
1 P
1 A
1 P
1 H
1 H
1 A
1 P
1 A

I need to count each bill type such as P=3, A=3, H=2. How would I write that in a formula? Would I use an If statement?

Thanks

 
You'd need something like the following
Code:
// Zeroise at start (or in the Group Header)
whileprintingrecords;
NumberVar MyCount:=0
Code:
// Accumulate selectively for each detail line
whileprintingrecords;
if {BillType} = "P" then
NumberVar MyCount:=MyCount+3
else if {BillType} = "H" then
NumberVar MyCount:=MyCount+2
Code:
//Display
whileprintingrecords;
NumberVar MyCount

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
You could insert a group on {table.billtype} and then right click on {table.billtype} in the detail section, and insert a summary (count). If you can't reorder the data and therefore can't group, insert running totals for each subtotal using the expert, and choose count of {table.billtype}, evaluate using a formula:

{table.billtype} = "A"//change to "H", etc., in new rt

Reset on change of group (bills, if you have a group) or never if at the report level.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top