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

Splitting a report into multiple archive entryes in DB - Possible ??

edited November 2002 in Devices
Can anybody tell me if this is possible, and if so, how.
Senario:
I have a report that generate letters to many customers. (grouped by
customer nr.). The report prints out every letter to a printer in one spool
job (I hope to avoid generating one spool job pr customer). At the same time
Each letter (page) is to be saved as an archive(file) in a db. Later I can
then go to a spesific customer, look at letters to this customer, and read
one spesific letter from the archive.

Thanks
Trond.

Comments

  • edited November 2002
    Sorry, The environment is: Delphi7, RB 7.0 Enterprise

    Trond


  • edited November 2002
    The easy part will be printing all customers as one print job. Use one
    TppReport and run it over all the customer data. Call Report.Print.

    The TppDBArchiveDevice is on the todo list. So, we have to use an alternate
    method. The way to send different customer letter as archives to a db, will
    be to stream the archive files individually as blobs to a database. First,
    you need N customer letter archives as separate files. I would run the
    report, but not connect it to any devices in order to cache the pages in
    memory on the report (Report.CachePages = true). Then you can use a
    TppArchiveDevice to recieve pages manually so that you can create an archive
    file for each customer. The code would be something similar to:

    ppArchiveDevice: TppArchiveDevice;

    ppArchiveDevice.Publisher := ppReport1.Publisher;
    ppArchiveDevice.PageRequest.PageSetting := psSinglePage;

    for liIndex := 1 to MyCustomerRecordCount do
    begin

    ppArchiveDevice.FileName := 'Customer' + IntToStr(liIndex);
    ppArchiveDevice.StartJob;
    ppArchiveDevice.PageRequest.PageRequested := liIndex;
    ppArchiveDevice.ReceivePage(ppReport1.Publisher.Pages[liIndex - 1]);
    ppArchveDevice.EndJob;

    end;

    Then you have N letter archive files. Now you can use the main reports demo
    #155 to stream the archive files to the database and then use the
    TppDBArchiveReader component to view the different archives.

    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.