Conditionally print Page2

Hi,

If I print an invoice, if user specify a rtf file name at data entry, I want Page2 to be printed.

I tried it this way but it doesn't work if I print a range of invoices. Works only if I print one invoice.

Any tips? TIA


procedure PageFooter1OnAfterPrint(Sender: TfrxComponent);

var a_: array of string ;   

begin

 if ( <Page> = <TotalPages> ) then

   begin        

    a_ := CallHbFunc('frAppendixFile', [cAppendixCode, cInv]) ;

    cAppendix := a_[1] ;

    cAppendixName := a_[2] ;                               

    Page2.visible := (trim(cAppendix) <> '')

   end ;           

           

end;

Comments

  • You may set visibility of TfrxReportPage in the main procedure of the script

  • Doesn't seem to work.

    Inv 2 should print Appendix 1 (user assigned rtf file) after done printing Inv 2.

    Inv 3 should print Appendix 2, after done printing Inv 3.


    Right now, if I print just Inv 2, then Appendix 1 will be correctly printed.

    If I just print Inv 3, then Appendix 2 will be correctly printed

    If I print Inv 2 - Inv 3 however, Fastreport will print Inv 2, followed by Inv 3 and then followed by Appendix 2. Appendix 1 not printed.


    I am trying to get Inv 2 + Appendix 1 followed by Inv 3 + Appendix 2


    TIA 😄.


  • If any further info required, please inform. I haven't been able to resolve the issue


    TIA

  • You can set visibility of TfrxReport page in the main procedure of the script only.


    begin

    Page2.Visible := False;

    end.

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.