How to display 'grouped by' data in the page footer?

hsmhsm
edited January 2013 in FastReport 4.0
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

Comments

  • edited 7:45PM
    Howard,

    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
  • hsmhsm
    edited 7:45PM
    Mick.pl wrote: »
    Howard,

    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.
  • hsmhsm
    edited 7:45PM
    Mick.pl wrote: »
    Howard,

    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 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
    TheDept:=<frxDBDatasetAllDataForSefRept."DeptName">
    if instead I used
    TheDept := MemoDeptName.text
    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

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.