Scripting issue - Variables and new page

edited July 2015 in FastReport 4.0
Hi All,

Got a bit of a puzzle with FastReports 4 scripting I am wondering if anyone may have an idea on. Have spent over a day on this and its doing my head in.

I am reporting on a simple table looking much like this ??¦
ItemIndex StartSequence EndSequence ItemDetails
1 1 10 Stuff
2 11 20 More Stuff
3 21 30 Other Stuff

The data is displayed in a basic master data band, with a hidden child band that has an out of sequence warning message.
If the End sequence of the previous record and the start sequence of the current record are out, I display the hidden band giving a warning.

I have a couple global variables iFirst and iLast to store the Start and End sequence values.
On MasterData BeforePrint I have a script??¦.

iFirst := <frxDBDs."1st ">;
if (iLast <> 0) and (iLast <> (iFirst-1)) then
begin
ErrorHighlight.Visible := True;
end
else
ErrorHighlight.Visible := False;
{ Set New Ctrl Break V'Ble }
iLast := <frxDBDs."Last">;

Now this works fine, until we come to page breaks. The first record of the new page will ALWAYS say that it is out of sequence even when it is not. The value of the variable on the new page is always reset to the current record it is displaying.

I am thinking it may be the way the engine handles new pages that is causing the issue, and I might just be out of luck. I have tried to make the report double pass and use engine.FinalPass, tried using scripts on beforeprint, afterprint, tried storing the value in pagefooters, tried pleading to higher powers ??¦ still no joy.

What would be the cause of the variable resetting on new pages?

Cheers

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.