Gena
Posts: 591
|
| Posted: 06/16/2008, 3:08 PM |
|
How do I count Groups in the Report? I mean I need to put numbers before GroupName that counts current group, like this
1. GroupName1
items
items
items
2. GroupName2
items
items
items
3. GroupName33
items
items
items
4. GroupName44
items
items
items
_________________
Gena |
 |
 |
wkempees
Posts: 1679
|
| Posted: 06/16/2008, 4:19 PM |
|
1. Position cursor before label containing Groupname, add a space and a, Before space insert Form:Label.(ReportLabel1)
2. Set it's properties to CodeExpression, Control Source: blank, DataType Integer.rest default.
In its BeforeShowEvent, enter
global $MyGroupCount;
$Component->SetValue( $MyGroupCount +=1 );
That's it.
Walter
Output:
Store Products
Category Id Product Id Product Name
1. 0
5 PHP and MySQL Web Development
2. 1
2 Programming Perl
3 Perl and CGI for the World Wide Web
.......
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
Gena
Posts: 591
|
| Posted: 06/16/2008, 5:08 PM |
|
Walter, thank you as usual.
Yes, I have done it already in this way. And was thinking if there is build-in way (Report standard) like using Count function etc. It seems that it works wrong with Group...
_________________
Gena |
 |
 |
wkempees
Posts: 1679
|
| Posted: 06/16/2008, 8:45 PM |
|
Properties of (above set) ReportLabel2:
control Source Type: Database Column
Control Source: category_id (my group item)
Data Type: Integer
[...]
Function: Count
Reset at: category_id, Group : counts the number of items in a group
Reset at: Report: counts the number of items (runningtotal)
It seems the Before Show method (edited my post BTW) is the way to go.
Cannot determine if this is wrong or intended.
(? ask support ?)
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
Gena
Posts: 591
|
| Posted: 06/16/2008, 11:36 PM |
|
Thanks Walter,
Quote wkempees:
Properties of (above set) ReportLabel2:
control Source Type: Database Column
Control Source: category_id (my group item)
Data Type: Integer
[...]
Function: Count
Reset at: category_id, Group : counts the number of items in a group
Reset at: Report: counts the number of items (runningtotal)
Yes, I have tried this way but got this result:
3. GroupName1
items
items
items
6. GroupName2
items
items
items
9. GroupName33
items
items
items
12. GroupName44
items
items
items
so it also counts items instead of proper groups number.
_________________
Gena |
 |
 |
|