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:08PM
    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

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.