>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
=StudentsPerTutor(Sign-ins.TutorId)
HTH