Home General

Merging Multiple Reports Together

edited July 2010 in General
Hi,

I've got a project where I need to be able to merge multiple reports
together, and display them as one report through the print preview
window within my application.

I have opted to save the reports as an archive (.raf) file, and then use
the TkuRAFMerge component to merge these reports together, finally
showing the reports using the archive viewer.

This allows the user to see the reports how they normally would any
other report. (ie, it's not exported as an external PDF file that is
'handled' differently).

The problem that I have is that when I do this, everything apperas to
work correctly and I get to see the merged report at the end - but there
is no data within the reports. (It ends up like a 'blank' report).

In these instances each report is located on a separate form. The
following happens:

1) The form is created.

2) The report has the following properties set:

Report.AllowPrintToArchive := true;
Report.AllowPrintToFile := true;
Report.DeviceType := 'ArchiveFile';
Report.ShowPrintDialog := false;
Report.ArchiveFileName := .RAF
Report.Run;

3) The form is free'd / distroyed

4) Steps 1-3 are repeated for all required reports.

5) The merge is done on the saved .RAF files and

6) The merged .RAF is loaded into the TppArchiveReader and printed to
screen.


Do Archive files not record the data, and only the report layout/template?

Is there something that I'm doing wrong with the above steps please?

I'm running RB 10.09 on Delphi 2007.

Thanks & Regards

Adam.

Comments

  • edited July 2010
    Hi Adam,

    An archive is simply a snap-shot of a report that has already been
    generated. Everything that is displayed on screen/paper during the time of
    export, should be present when exporting to the archive file.

    As a test, try taking a look at each individual exported archive file before
    you merge them to make sure they contain the correct data. If not, the
    problem is most likely further up the line (report generation, data access).
    Check to see that you are able to preview each report before archiving them.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2010

    For RB 11 we added the ability to output multiple reports to a single file -
    any type of file - archive, PDF, etc. This is done by using the
    StartPrintJob and EndPrintJob boolean properties of the file device. We also
    added the ability to generate one report to multiple files - via the Group
    NewFile option.

    http://www.digital-metaphors.com/rbWiki/General/What's_New/RB_11

    For RB 12 we added even more output formats and features..

    http://www.digital-metaphors.com/rbWiki/General/What's_New/RB_12



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2010
    Hi Nard & Nico,

    Thanks for your replies...

    I have updated to Report Builder 12 today. I'm trying to figure out how
    to use the StartPrintJob and EndPrintJob boolean properties, and was
    wondering if you could help please.

    The only reference I can find to how to use these is on
    http://www.digital-metaphors.com:8080/Output/PDF/How_To...Merge_Multiple_Reports_into_one_PDF

    But this shows a PDF file. I was wondering if it's possible to use
    archives too (where one report's owner/form is destroyed before the
    second report is created) to merge multiple reports together and 'view'
    them, or if I still require the TkuRAFMerge component.

    Thanks & Regards

    Adam.
  • edited July 2010
    You can use the same approach as shown in the rbWiki article you reference.
    The ArchiveDevice has the same StartPrintJob/EndPrintJob boolean properties
    as the PDFDevice, all the file devices in RB have these properties.

    I don't think it should matter whether you are creating/destroying each of
    the reports.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2010
    Hi Nard,


    Thanks for your reply. Could you please let me know which unit I should
    be referring to for the TppArchiveDevice. I'm unable to locate it.

    Thanks & Regards

    Adam.
  • edited July 2010
    Hi Adam,

    The TppArchiveDevice class can be found in the ppFilDev.pas file.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2010
    ppFilDev. If you want to locate the unit in which a class is defined, use
    the Delphi Search | Find in Files dialog to search against the
    RBuilder\Source directory. :)

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

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