How not to print a page according to a data ?

jezabeljezabel Angers, France
edited 9:47AM in FastReport 4.0
Hi everyone,

I have to print bills for some companies but according to the type of company, the page doesn't need to be printed.
I get the type of company in the masterdataband. It is a 2 pass report yet.

If I try to stop or terminate the report, nothing is printed.
In Delphi, to run the report we put :

frxReport.PrepareReport;
if not frxreport.Terminated then
frxReport.ShowPreparedReport

Can anyone help me ?
Thank you in advance
Jez

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 9:47AM
    if this is a multi design page report, use the onbefore print event of the page to set the page's visible property according to the datafield value, where and how you retreive and store the value
    is up to you Without more information cannot be more specific.
  • jezabeljezabel Angers, France
    edited February 2009
    Hi Gordk,

    It is a simple page report. But 'start a new page' is set on the MasterDataBand.
    I've already tried the visible property of the page report, but certainly not at the right place.
    There is no TitleBand. The MasterDataband contains the title and the companies address.

    Here is a piece of my code :
    procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
    begin                 
                  
      if not engine.finalpass then
      begin
        //* do not print the page if company's type is 'CPAM'                                                                              
        CPAM := (<dmTP."OCPAM"> <> 0);  //* dmTP = external dataset linked to the masterdataband
        //Page1.Visible := not CPAM;            //* I've tried that
        if CPAM then                                  
          //Engine.StopReport                       //* and this
          Report.Terminated := True                                                              
        else                          
        begin
            ...
    

    I hope it's usefull to understand.

    Thanks again
    Jez
  • gordkgordk St.Catherines On. Canada.
    edited 9:47AM
    hide the mdband by setting it's visible property in it's obp event.

    masterdata1.visible := not (<dataset."fieldname"> = 0);
  • jezabeljezabel Angers, France
    edited 9:47AM
    I didn't said that there are other bands (1 groupheader, 2 detaildatas, 1 groupfooter and 1 pagefooter)
    The masterdataband is not visible but not the others.
    Even if I put the same code for each band (GroupHeader1.Visible := MasterData1.Visible;) in their obp event.
  • gordkgordk St.Catherines On. Canada.
    edited 9:47AM
    it is very hard to try to help you when you don't give all the information.
    if you can please post a demo project in the binaries news group.

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.