PageHeader on First Page contains data from last record

I have a report with a PageHeader band and am displaying a variable from the database record in that band. In a multiple page report the display is fine for all pages except the first page, where the data in the PageHeader is from the last record of the dataset. This data also shows in the last page of the report. The table is a Firedac MemTable accessed as an frxDbDataset.

I would expect that the first PageHeader would be accessing data from the first record in the dataset.

For debug purposes, I placed the variable in the other report bands and the incorrect record is displayed in the ColumnHeader band, but not the Group Header1, GroupHeader2 or MasterData1 bands of the first page. They show the first record correctly.

I have tried assigning to a variable in the PageHeader OnBeforePrint event, but the results are the same.

Any idea on how to correct this?

Comments

  • Try to use

    MasterData1.Dataset.Open;

    MasterData1.Dataset.First;

    in the PageHeader.OnBeforePrint event

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.