How to switch pages on printing

Hello,
I have a report that contains two pages: Page1 and Page2. I'd like to switch pages dynamically according to some condition during the printing:

if <data.SomeValue>=true then show (and print) only Page1
if <data.SomeValue>=false then show (and print) only Page2


... so, whole report maybe look like:

page #1 .. print Page2
page #2 .. print Page1
page #3 .. print Page1
page #4 .. print Page2
page #5 .. print Page1
page #6 .. print Page2
.. .

I try put following code into report, but it doesn't work properly:

procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
Page1.visible:=<dataset1."ID">=0;
Page2.visible:=<dataset1."ID">=1;
end;

procedure Page2OnBeforePrint(Sender: TfrxComponent);
begin
Page1.visible:=<dataset1."ID">=0;
Page2.visible:=<dataset1."ID">=1;
end;

Best Regards!

Comments

  • edited 12:32AM
    You can't switch the page visibility when the page is started. And you can't choose dymaically which page to print right now: FR will print all records on Page1, then all records on Page2, then report will be finished.

Leave a Comment