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

Distributing Database Templates

edited September 2005 in End User
Hi,

I am using D5, RB 7.0 and the MSDE. I am starting to save report templates
in a binary format in the database. I am just wondering if I create a new
report, how do I physically get a copy into my clients databases.

All other database updates are done using scripts.

Thanks for any help, I couldn't find anything that addresses this issue in
any of the documentation.

Kind Regards,
Matthew Pascoe

Comments

  • edited September 2005

    1. The rbItems and rbFolders tables are no different from other database
    tables, so I think using a script should work fine.

    2. Another option is to export the reports to .rtm files and then import the
    .rtm files into the database.

    Note sure if that answers your question, if not post a follow question
    here...

    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2005
    Hi Nard,

    Option 2 sounds like it is the best option for me. How would I import the
    .rtm file into my database?

    Thanks and sorry if this is a stupid question.

    Regards,
    Matthew

  • edited September 2005

    One way to do this is to use the Report.Template object to load the .rtm
    file and then save it to the database.

    1. Load the .rtm file

    myReport.Template.FileName := 'c:\myReport.rtm';
    myReport.Template.LoadFromFile;

    2. Save to database

    a. configure the Report.Template.DatabaseSettings for the rbItem
    datapipeline.

    b. call myReport.Template.SaveToDatabase

    c. use the Report.Template.OnSaveEnd event to set the values for the
    additional rbItem fields. This is the technique used by the report explorer.
    For an example check out RBuilder\Source\ppRptExp.pas, the method called
    ReporSaveEndEvent. Here is a copy of that code...

    procedure TppReportExplorer.ReportSaveEndEvent(Sender: TObject; aStream:
    TStream);
    begin

    if (TppTemplate(Sender).SaveTo = stFile) then Exit;

    FItemPipeline.SetFieldValue(FItemFieldNames.ItemType, FCurrentItemType);
    FItemPipeline.SetFieldValue(FItemFieldNames.FolderId, FCurrentFolderId);
    FItemPipeline.SetFieldValue(FItemFieldNames.Size, Integer(aStream.Size));
    FItemPipeline.SetFieldValue(FItemFieldNames.Modified, Now);

    end; {procedure, ReportSaveEndEvent}






    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com



    Best regards,

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