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

Print to File - TDataSet.

edited December 2002 in Devices
This is a new area for me so thanks for your patience. I would like the
print to file capability of built into Report Builder. I like the ability
to select which compenents should "print". Is there information on how to
extend this to print to a database table rather than ascii delimeted text?
I just want values from the components in a particular band, no special
layout or formating - just the data. Would this be a custom "Device?"

Comments

  • edited December 2002
    Hi Adam, you could create a custom device. How do you want to store the
    report output? You could create a native report archive file (raf) and save
    that to the database by streaming it directly to a BLOB field as shown in
    the main reports demo #155. Then you can load the report archive and print
    it using the DBArchiveReader component to the screen, a printer or comma
    delimited text file. This is what I would do given this circumstance.

    If you want the data saved to the database, then create a SQL statement on
    the fly to create a new database table on the fly based on the selected
    fields (use the component's Save property like the file device does in
    ppFilDev.pas) and then populate that table. This would mean that you would
    have a new table for every report run. You'll end up with a lot of tables.

    An alternative is to alter the output so that it fits in a single column.
    You could place it in a single table which holds records for all report
    output. This would be a single record with the same data that would be in an
    output text file, with commas in it. This will lead to one very large table,
    or you can break it up and create new tables, one for each output report,
    much like a file device does when it creates a text file. The latter is
    probably what you had in mind, since it parallels the file device, but
    you'll have to code it into a new custom device. You can create a new device
    and register it, or use it as a replacement as shown in this example:

    http://www.digital-metaphors.com/tips/UnQuotedFileDevice.zip

    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.