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

Load Rtm File

edited February 2005 in General
How can i load an existing RTM file to a database field ?

i try

ppReport1.Template.FileName := OpenDialog1.FileName;
ppReport1.Template.LoadFromFile;
ppReport1.Template.SaveToDatabase;

but every time it inserts a new record, and dont update over actual record.
--
Jorge C. Mosquera R.
Investigaci?n y Desarrollo
www.sitis.info

Comments

  • edited February 2005
    Hi,

    You need to be sure you are defining all the
    Report.Template.DatabaseSettings properties or else ReportBuilder will not
    know which record to save the template and will by default save it in a new
    one. See the TppTemplate.DatabaseSettings topic in the ReportBuilder help
    for more information.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2005
    I save it to a stream and then manually save it to a db field--gives me the
    flexiblity I need. Some code snippets (for a Firebird DB with IBO):

    lDesigner.Report.Template.SaveToStream(lMS);
    SaveDBReport(aReportID, lMS);

    procedure TfrmTRAKPrint.SaveDBReport(aReportID: integer; aStream:
    TMemoryStream);
    var
    lTx: TIB_Transaction;
    lDSQL: TIB_DSQL;
    begin
    lTx := CreateTransaction;
    lDSQL := CreateDSQL(lTx, 'Update Reports set TheReport = :TheReport where
    Report_ID = %d', [aReportID]);
    try
    lTx.StartTransaction;
    try
    lDSQL.Prepare;
    lDSQL.Params[0].Assign(aStream);
    lDSQL.ExecSQL;

    Assert(lDSQL.RowsAffected = 1, Format('Rows Affected (%d) should equal
    1 but does not.', [lDSQL.RowsAffected]));

    lTx.Commit;
    except
    lTx.Rollback;
    raise;
    end;
    finally
    lDSQL.Free;
    lTx.Free;
    end;
    end;



    --
    Ed Dressel
    Team DM
This discussion has been closed.