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

LoadFromFile / SaveToDatabase

edited October 2003 in General
I am implementing RBuilder into application and saving all report to
database. I want the user and developer ot be able to export reports to
file, email, and then import the report and save to database. I am storing
the reports in a MS SQL database with no problem.

I use ppReport1.Template.SaveToFile and successfully save the report to a
rtm file. However, when I import the report using LoadFromFile, it seem
that it does not get the report name for saving the report. I am trying to
import and save without actually running the report.

For example, the following code fails because there is no report name:

{import report from file}
try
ppReport1.Template.FileName :=fFileName;
ppReport1.Template.LoadFromFile;
ppReport1.Template.SaveToDatabase;
except
raise;
end;

However, the report name is stored in the .rtm file as below:
Template.DatabaseSettings.Name = 'Codes List'

How can I import / export without running the report and automatically get
the report name? Am I forced to use the offset property and manually save
the report name?

Thanks,
Bob

Comments

  • edited October 2003
    In further testing, I find that when I use SaveToFile, the
    Template.DatabaseSettings.Name value is saved in the text. However, when I
    LoadFromFile, the value is lost and there is no report name. Can you
    confirm this behavior and tell me if there is a way to maintain the report
    name?

    Thanks,
    Bob Tucker

  • edited October 2003
    Hi Bob,

    You will need to set the Template.DatabaseSettings.Name before you call
    Template.SaveToDatabase. To make things easier on yourself, you should name
    the files the same as their corresponding report names on database. This
    way you can simply strip off the .rtm part of the file name and use it in
    the database. If you are unable to do this, you will need to find a way to
    match the file names to the report names in your database.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2003
    That is sort of what I figured. It just seems to me that when you import
    the report from file, the properties saved in the file should import and
    therefore the report name would be recognized.

    Anyway, I will come up with something.

    Thanks,
    Bob

This discussion has been closed.