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

Can I tell if a loaded rpt has a component?

edited August 2002 in General
I have a situation where I am loading a report template from a disk
file.

Once the report template is loaded, is there a way to tell if it
contains a particular component, either by ComponentName or UserName?

Also,

What happens if I load a report template (.rtm file) from disk at run-
time and the template contains components for which I don't have
variables on my Tform? Do they get added in the same way as when a
component is dropped onto the report designer at design-time?

Thanks,

Allen.

Comments

  • edited August 2002
    There are a number of Find* functions in the report suchs as FindComponent,
    etc.

    When loading a report from a template you shouldn't have the same vars on
    the form as are in your report. This is the while point of template, all
    those components will get created at runtime when the template is loaded.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited August 2002
    In article <3d53c6c8$1@dm500.>, "Alexander Kramnik \(Digital Metaphors
    \)" says...
    So does this mean that after creating the templates and storing them to
    disk, I should remove all the components added into the report designer.
    this would then leave me with a bare TppReport as if I had just dropped
    it on the form and only gave it a name.

    If the report on the form is bare as I just described, when the form
    template loads from disk will the form labels, fields, memos, etc. load
    with the same name as they had when the template was originally created
    in the report designer?

    What about events tied to variables? Do these get linked up
    automatically, or do i need to do something special?

    Thanks,

    Allen.
  • edited August 2002
    Yes, the template saves the published properties in the template. The
    components will be create with the same name in the form, iff there isn't
    one already in existance in the same form. Event handlers will get
    reattached if possible, although you will quickly get into trouble with this
    approach. The solution is to use RAP, where you can store the event
    handlers inside of the report template and not on a form unit. Please see
    the TechTips newsgroup in the Templates thread for some good information
    about templates and also the RBuilder help file on TppReport.Template.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.