Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding a Group Counter
Message
From
22/09/2006 03:11:55
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01156251
Message ID:
01156295
Views:
21
>I have a report that looks like this:
>Group Header 1: Tutor
> Group Header 2: Class
> Group Header 3: Student
> Detail: Sign-ins
> Group Footer 3: Student
> Group Footer 2: Class
>Group Footer 3: Tutor
>
>I want to count the number of students (appearing in group header 3) per tutor. I tried adding a field with expression = student, Calculate = Count, Reset based on Group = Tutor and put that field in the Group Header 3 band. However, I'm getting a count of the number of Sign-ins and not the number of students. I also tried putting a field with expression (Select count (student) where tutor = reportcursor.tutor), but that just generated an error. Any ideas?
>By the way, I'm trying to solve this in the Report Designer itself as the application is already distributed and I am trying to help a user customize the report with this field (users can edit reports via the application). TIA.

Hi Mon,

There is few solutions (that I know/use) to show counts at group header levels but none using standard frx functinality.

1. You can prepare (preprocess) cursor with all counts already in place and then just expose those counts (tmp cursor fields) via ordinary report expressions at group levels.

2. For your case where is only one count that needs to be presented, you can also use simple UDF to accomplish this.
From ordinary report expression placed in group header, you simply call
your UDF - wich then returns that count value.
Hence, it is better to apply that function on tmp cursor - COPY of the one you are reporting, then on main report alias itself.
For speed purposes on that cursor/copy you can add tmp index tag(s) as per your convinience.
function StudentsPerTutor 
lparameters nTutorId
.
blah blah
.
return nStudentCount


*In report expression (from grp Header) you wil put simply call to yr udf like 

=StudentsPerTutor(Sign-ins.TutorId) 
HTH
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform