New Blog Post: PDF/A and Metadata

Group names chang when loading template

edited August 2002 in End User
Hello,

I haved designed a report using the end user solution. The report contains
two groups with summaries.

To print the report from inside my delphi app, I load the report using
LoadFromDatabase. But now the summaries for each group aren't reset anymore.
To find the reason, I saved the template to a text file right after loading
it from the database:

..
Rep.Template.LoadFromDatabase;
Rep.Template.FileName := 'X.RTM';
Rep.Template.SaveToFile;
..

The ResetGroup property ("ppGroup1") of the TppDBCalc is unchanged , BUT the
name of the group changed from "ppGroup1" to "ppGroup2". The names of all
other components have also changed.

How can I keep RB from renaming all components when loading a template?

Thanks
Georg

Comments

  • edited August 2002
    Hi Georg,

    I don't think RB changes any component name when loading a template.
    RB uses the component streaming from Delphi, used for forms too.
    I would change the group reset and save the report again into your database.

    HTH,
    Chris Ueberall;

  • edited August 2002
    Hallo Chris,

    the component names DO change.
    The Delphi streaming system is used, but for each component, the component's
    constructor is called.

    I have already tried to change the reset group, I have even recreated then
    whole report from scratch, but the result is always the same.

    Georg


  • edited August 2002
    Georg,


    how do you verify that?
    Does the names differ from that one in the rtm file?

    component's

    sure, the streaming system has to call the constructor, the only way to
    create an object.
    After the creation all published properties will be read, component name
    inclusive.


    and did you save it into your database?

    regards,
    Chris Ueberall;
  • edited August 2002
    Hello Chris,

    meanwhile I found the problem (or bug).

    My form contains two TppReport components, one that contains a static
    report, one that is used for dynamically loading reports from the database.
    Some of the component names in the dynamically loaded reports are the same
    as the names of components in the static report. If RB finds the same name
    during loading the template, it generates a new unique name. Unfortuantely
    this may also happen to the name of groups. If this happens, the ResetGroup
    property of all calculated fields point to the wrong group, since the
    property value is not adjusted to the new group name. See
    TppReportTemplate.LoadSetName in ppTmplat.pas.


    Georg

  • edited August 2002
    Georg,

    I am glad to hear you found the problem. (I thought, that in this case a
    message box would be shown and complains the already existing component with
    the same name).
    Do you really need the second report component? (I guess no)

    regards,
    Chris Ueberall;

  • edited August 2002
    If you are using templates, then you should only use one report object for
    loading of templates in a form, just to make sure that everything goes
    smoothly.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.