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

Pull multiple fields from one record for group header

Status
Not open for further replies.

highfill

Programmer
Mar 7, 2003
3
US
I would like to retrieve and display multiple fields from a particular detail record in a group header. The record needs to be selected by a Min or Max function on one of the fields relative to the other detail records within the group. Finding the Min/Max is easy, but how do I access the other fields from that same record?

I suppose I could stash all the fields for that record in global variables then retrieve them when I render the header, but that seems like a real hack. Is there a more elegant way to reference all the fields of a particular record from a group header?

Thanks,
Darren
 
Posting example data and expected output will help.

It may be that you can group by the fields that will comprise what it is you want to display first, so you can just place the fields in the Group Header.

-k
 
Example:


(GH) Day: 3-7-03

(D) Interval_Start: 06:00 Calls: 10 Occupied: 12470
(D) Interval_Start: 06:30 Calls: 15 Occupied: 15590
(D) Interval_Start: 07:00 Calls: 22 Occupied: 18870
(D) Interval_Start: 07:30 Calls: 24 Occupied: 22670
(D) Interval_Start: 08:00 Calls: 18 Occupied: 14470
.
.
.

(GF) Time_of_Peak: 07:30 Calls: 24 Occupied: 22670



----------------
Finding the peak number of calls and displaying that in the footer (or header) is easy, but how do I retrieve the correlated fields from the same record to put them in the footer?

|-D
 
If I understand this correctly, you want the row with the most Calls to be displayed in the header or footer.

If you cannot sort by this column, as it appears you are sorting by the interval_start, then I think that you'll need a subreport, which will be slower.

Place a subreport in the Group Header (or footer as you example shows) which is basically the same as the Main Report, except that you sort by Calls, descending, rather than interval_start.

Now display the columns in the subreport group header, and suppress all other sections.

Join the subreport to the main by the Day.

Now each group header in the subreport will return only one row, the maximum calls (or whatever field you want to be used as the max, sort by it).

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top