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

Report template problems

edited August 2001 in General
I am getting some strange behaviour which i hope someone will be able to
help me with.
I designed a quotations report at design time and this report was used when
users wanted to either view the report or change it using the report
designer.
This form was then made into a Delphi package which is called dynamically at
runtime.
I thought everything was working fine until i realised that when the users
changed anything with the designer, then those changes only remained while
the application was running. I.E.When they started the application again
the changes previously made were not there and the original report was
loaded.
I thought i would be able to sort this out by making sure the
Report.Template.Filename property was pointing to a report before the report
or designer was opened, but still the old report is loaded.
The only way for the user to get the changed report is to open the designer
and then go and load the report manually.
Am i doing something wrong ?

Thanks
John

Comments

  • edited August 2001
    Hi John,

    you have to load and save the template programatically.
    See the TppTemplates stream procedures :
    LoadFromDatabase, LoadFromFile, LoadFromStream, SaveToFile, SaveToDatabase,
    SaveToStream
    There are some articles about templates in the tech-tip section you should
    read.
    You may be more flexible when storing the templates not in your DLL or EXE.
    I personally use the file orientated solution for my own reports, my
    end-users usually store their own creations in a database table.

    regards,
    Chris Ueberall;

    when
    at
    report
    designer
  • edited August 2001
    Oops. I do feel an idiot now. I don't know how i missed the
    Template.Savetofile procedure but still.
    There is one more thing that's puzzling me.
    If i set the report template filename to a .rtm file and call the
    template.loadfromfile procedure everything works fine.
    If the file that template filename is pointing to does not exist, how is it
    that the same report is displayed ?
    I would have expected an empty report as the template file is not there.
    Thanks
    John
  • edited August 2001
    Hi John,

    it

    I guess, since the file doesn't exists, nothing happened and the report
    layout embedded in your form got displayed.
    When loading all templates from file or database (my suggestion) you can
    delete every reports content during design-time to minimize the DFM size.

    regards,
    Chris Ueberall;
  • edited August 2001
    Ok. Thanks again for your help and advise.
    John
This discussion has been closed.