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