How to display 'grouped by' data in the page footer?
I have a report grouped by Department that contains a couple of sub reports. Each group (ie department) takes up four or five pages.
Because of this, in the page footer I display the Department name so the user can see which group's data they are looking at.
This works fine except for the last page in each group. Instead of the footer of the last page in the group showing the correct department it shows the department for the next group in the report.
I guess what happens is the group finishes part way down the page and the engine switches to the next group, THEN the footer of that page is printed by which time the group name has already changed to the next one.
How can I make the page footer correctly show the data relating to the group on that page?
Image of my design is below
Because of this, in the page footer I display the Department name so the user can see which group's data they are looking at.
This works fine except for the last page in each group. Instead of the footer of the last page in the group showing the correct department it shows the department for the next group in the report.
I guess what happens is the group finishes part way down the page and the engine switches to the next group, THEN the footer of that page is printed by which time the group name has already changed to the next one.
How can I make the page footer correctly show the data relating to the group on that page?
Image of my design is below
Comments
I would try to create a variable and set its value in OnBeforePrint event of GroupHeader.
Then I'd use this variable in OBP event of PageFooter to fill the MemoView.
I assume that next GroupHeader will start a new page.
Regards
Mick
Thanks, I'll give that a go.
Yes, the group header is set to start each group on a new page (that's why I was a little mystified why I got the result I did as I expected the page break to happen after the group had changed ie I expected the last page footer to still be the old group.
Thanks Mick, that worked
Although interestingly I had to use the data from the dataset, and not the data in the group header memo that was already showing the department name (MemoDeptName).
ie
When storing the data in my variable in the obp event of my group header I had to use
if instead I used
then I got the first department name on every page in the report, even though the MemoDeptName itself was still showing different departments on the appropriate pages.
Never mind, another issue resolved!
Howard