Home Subreports
New Blog Posts: Merging Reports - Part 1 and Part 2

Header Bands?

edited September 2004 in Subreports
I have two different versions of an invoice, BOTH of which need to print out
EVERY time one after the other. If I am printing 500 invoices then I have
to iterate through the invoice table and print each report for every invoice
to get them on after hte other. I tried putting them into subreports in a
master report so that I could run the report for all of the invoices at once
but both have a page header and a page footer that MUST print. I tried
using the group headers and footers but the group footers don't print at the
bottom of the page!!! I need to know how to do this so that I can get rid
of the overhead of calling the report twice for each invoice.

Any help would be greatly appreciated!!!
Branden Johnson

Comments

  • edited September 2004
    I think I remember seeing a post a good ways back about printing the two
    pages to memory and then collating them and then printing tham as a single
    report?

    Maybe this would work but I can't fin any info about it???

    Thanks,
    Branden Johnson

  • edited September 2004
    Hi Branden,

    Have you tried using Section Style subreports? These subreports were
    specifically designed to give the effect of combining two reports into one.
    They also allow access to the page header and footers. I would suggest
    placing two Section Style subreports in the detail band of your main report
    (having the second one shift relative to the first one of course), then
    simply loading the template of the invoices into each subreport. You can
    select the style of a subreport from the popup menu of the subreport
    component by right clicking on it.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2004
    Thanks!!!

    I loaded the two reorts into section style subreports and it works greate
    from the report explorer. But when I call the report from code via a call
    to Report.Template.LoadFromDatabase the report doesn't print any of the
    header or footer bands but does print the detail and the page style band
    infinitely. I don't know what I'm doing wrong here.

    Thank You,
    Branden Johnson
  • edited September 2004
    I don't know why the later didn't work but I modified the code to call the
    ReportExplorer.LoadReport and it worked great???

    Thank You Nico,
    Branden Johnson
  • edited September 2004

    The following article contains detailed information about loading reports
    stored to the report explorer database tables...

    ---------------------------------------------------------------
    Tech Tip: How to Programmatically Load Reports that were Saved
    using the Report Explorer
    ---------------------------------------------------------------

    1. The ReportExplorer has a run-time interface you can use to load reports
    using the ReportExplorer.LoadReport method. You can use this method without
    actually 'showing' the report explorer form. (See the online help topic for
    TppReportExplorer.)

    2. If you want use Report.Template.LoadFromDatabase, RB will locate the
    report stored in the database table based upon the NameField value only.
    However, for the rb_item table you need Folder_Id, Name to locate a record
    uniquely.

    To override this default behavior, assign an event-handler to the
    Report.Template.OnLocateRecord event.

    example:

    TmyForm = class(TForm)
    private
    function ReportLocateRecordEvent(Sender: TObject; const aReportName:
    String): Boolean;

    end;

    procedure TmyForm.FormCreate(Sender, TObject);
    begin
    {assign the event handler}
    FReport.Template.OnLocateRecord := ReportLocateRecordEvent;

    end;


    function TmyForm.ReportLocateRecordEvent(Sender: TObject; const aReportName:
    String): Boolean;
    begin
    {add logic here to locate the record and return True if it is found}

    Result := myLocateReportFunction(FFolderid, aReportname);

    end;




    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.