pagefooter has masterrecord for next page

edited 11:35PM in FastReport 4.0
Dear sirs,

When I ask out the dataset of the Master Band in the pagefooter it already contains information of the record that is there for the next page. I would like the dataset cursor to be on the last printed line in the page it concerns.
This makes it impossible for me to set totals in a band that is oriented with a fixed height from the bottom. Or might there be another solution.
This is quite important to me.

Wina

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 11:35PM
    i do not know what you mean by "ask out the dataset"
    1 read the user manual on using aggregate functions.
    2 you may want to use a column footer rather than a page footer.
  • edited 11:35PM
    I've tried columnfooter band but it gives me the same result: The dataset of the materband is one line further than I need it to be.
    What i mean with 'ask out dataset'. In my report I have only one dataset it's the one that is connected to masterband.
    This dataset contains per record the data for the detail in Masterband, but every record contains also its repeateddata that is needed in the Groupheader/footer. So one record in the dataset contains master and detail information.

    Now some reports need the 'groupfooter information' on a fixed point from beneath. (not only aggregate functions, but sometimes for instance a payment term).
    This is how the reportbands look like:

    1. Groupheader
    2. Masterband
    3. Groupfooter
    4. pagefooter

    When groupfooter 3 has been printed, the cursor of the dataset is placed to the next record already. Implying that band 4 contains master data of the next record. Which is not very useful. I've tried placing a column footer between 3 and 4, same result. I've tried placing a column footer between Masterband and Groupfooter, but this is not allowed.

    The report is performed with double pass.
    Help is appreciated
  • Anu de DeusAnu de Deus Hampshire, UK
    edited 11:35PM
    Try moving back one record in your datasource:
    procedure OnGroupFooter1BeforePrint(sender);
    begin
      YourDataset1.previous;
    end;
    
  • edited 11:35PM
    After your suggestion. I've figured out:

    Masterdata1.dataset.prior in the OnBeforePrintFooter
    Masterdata2.dataset.next in the OnAfterPrintFooter

    I believe this might be the solution. Not tested fully yet but seems promissing

    Thanks

    Try moving back one record in your datasource:
    procedure OnGroupFooter1BeforePrint(sender);
    begin
      YourDataset1.previous;
    end;
    
  • edited 11:35PM
    WJansen wrote: »
    After your suggestion. I've figured out:

    Masterdata1.dataset.prior in the OnBeforePrintFooter
    Masterdata2.dataset.next in the OnAfterPrintFooter

    I believe this might be the solution. Not tested fully yet but seems promissing

    It's not help in my report. I have the same problem. My report have bands:

    1. PageHeader - have same general data like page numbers and some of data from Master dataset
    2. Groupheader1 - for reseting page number and Start new page on masterdata change
    3. MasterData1 - have property FooterAfterEach set to true
    4. Footer1 - some of summary data printed after all data from detail dataset
    5. GroupHeader2 - instead of column header - it have the same labels for the next 4 detail dataset
    6. DetailData1
    7. DetailData2
    8. DetailData3
    9. DetailData4
    10. Page Footer

    This works fine (maybe it help someone), but I need some of data from Footer1 printed on PageFooter (on the bottom of each page), Foter1 is still required for summary data after all details.
    When put field from master dataset in PageFooter, it is printed next data from master dataset.

    I created some new variables and fill them with data from master dataset. I have try to do this on difeerent events.
    Example:

    procedure MasterData1OnBeforePrint(sender: TfrxComponent);
    begin
    set('Name',<DS_master."NAME">);
    end;

    I have try to put this on different bands/events (before or after print), but on the PageFooter is always printed data from the next row in dataset.
    It is the same if I put this on PageFooter BeforePrint event:

    procedure PageFooter1OnBeforePrint(sender: TfrxComponent);
    begin
    Masterdata1.dataset.prior;
    set('Name',<DS_master."NAME">);
    end;

    procedure PageFooter1OnAfterPrint(sender: TfrxComponent);
    begin
    Masterdata1.dataset.next;
    end;

    And also I have some other problem. I need GroupHeader2 printed on all pages.
    For example, my report will be printed like this:

    On first page:

    1. PageHeader
    3. MasterData1 - some data from master row
    5. GroupHeader2 - instead of column header
    6. DetailData1
    7. DetailData2
    8. DetailData3
    9. DetailData4
    4. Footer1 - some of summary data printed after all data from detail dataset
    10. Page Footer

    If report continues to several pages, then on second page I will have this:

    1. PageHeader
    5. GroupHeader2 - this is problem - it will be printed only if there is not enough space for all rows from DetailData1
    6. DetailData1
    7. DetailData2
    8. DetailData3
    9. DetailData4
    10. Page Footer

    So on all other pages I will have this:

    1. PageHeader
    6. DetailData1
    7. DetailData2
    8. DetailData3
    9. DetailData4
    10. Page Footer

    And on the last page I have this:

    1. PageHeader
    6. DetailData1
    7. DetailData2
    8. DetailData3
    9. DetailData4
    4. Footer1 - some of summary data printed after all data from detail dataset
    10. Page Footer

    After that it is the same for the next row in MasterDataset.

    The question is: How to create one GroupHeader for all Detail data, so it can be printed on every page of report when there is some rows in DetailDataset ?
    If I create separate GroupHeader for each DetailData then it is too much waste of paper space.

    Thanks, and sorry for long post.
  • gpigpi
    edited 11:35PM
    Try to use child band for TfrxPageHeader and set child's visiblity in script
  • edited 11:35PM
    gpi wrote: »
    Try to use child band for TfrxPageHeader and set child's visiblity in script

    Thanks, I have solve that part, so my report have now those bands:

    1. PageHeader
    1.1 Child1 - as groupheader for second and further pages
    2. Groupheader
    3. MasterData
    3.1. Child2 - the same look as Child1 - becouse I need the same groupheader on first page, but after MasterData
    4. Footer - for summary data of MasterData
    5. DetailData1
    6. DetailData2
    7. DetailData3
    8. DetailData4
    9. PageFooter


    In script I have this:
    procedure Page1OnBeforePrint(sender: TfrxComponent);
    begin
    Child1.visible := false;
    end;

    procedure MasterData1OnAfterPrint(sender: TfrxComponent);
    begin
    Child1.visible := true;
    end;

    procedure Footer1OnAfterPrint(sender: TfrxComponent);
    begin
    // this is Footer for summary not PageFooter
    Child1.visible := false;
    end;

    Maybe that trick help someone else with similar problem.
    Problem with MasterData in PageFooter still remains.
  • gpigpi
    edited 11:35PM
    wrote:
    Problem with MasterData in PageFooter still remains.
    Try to store value from MasterData in variable in MasterData.OnAfterPrint event and print this variable on PageFooter
  • edited 11:35PM
    gpi wrote: »
    Try to store value from MasterData in variable in MasterData.OnAfterPrint event and print this variable on PageFooter

    Well, I have try this, please read my first post. It is not the same when printing each MasterData on new page or when you print sequentially.

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.