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

Archived reports in a database

edited January 2004 in General
Hello,
I want to use ppDBArchiveReader, but I have problems, and the technical tip
with TBlobField did not work (or I made something wrong).

I can successful save a report.raf.
I am using an ADS database table with one BLOB field.

Can anybody write a short code example, how I can store

report.raf into ADSTable1.FieldByName('MyBlob').AsString

It seems, that I can not address to that field in this way:
ADSTable1.FieldByName('MyBlob').AsBlob, although the datatype is BLOB (I
tried Image, binary and Memo).

Thank you for your help,
Anila

Comments

  • edited January 2004
    Hi Anila,

    First, in order for the DBArchiveReader to work, you will also need a Name
    field in your table. This enables the DBArchiveReader to load the correct
    archive because it has no way of telling them appart otherwise.

    In my testing, I was able to load an archive file to an Advantage database
    and then view it using the DBArchiveReader. Below is the code I used to
    load the archive to the database. I used a BINARY field to store the
    archive as a BLOB with the memo block size of the table set to 1024.

    var
    myFileStream: TFileStream;
    begin

    myFileStream := TFileStream.Create('myArchive.raf',fmOpenRead);

    try
    myFileStream.Position := 0;

    AdsTable1.Open;

    AdsTable1.Insert;

    AdsTable1.FieldByName('ArchiveName').Value := 'myArchive';


    TBlobField(AdsTable1.FieldByName('ArchiveFile')).LoadFromStream(myFileStream
    );

    finally
    myFileStream.Free;
    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.