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

using 2 report components

edited January 2002 in General
Hi,
in a form I have two report components using the same pipelines. One of them is used to preview some reports and the other for
printing - independently of the preview.
The first component I use works fine, but the second renders the reports incorrectly - though using the right data. If I first
print, the printing is correct, while the preview is broken and vice versa.

Any suggestions?

Thanks,
Christo

Comments

  • edited January 2002
    What is happening in the event handlers? The report gets the correct data,
    but it is rendering incorrectly? Check to make sure that there aren't any
    event handlers assigned to the wrong report.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited January 2002
    Hi,


    The problem appears, when both reports try to load one and the same template from the DB. The first
    Report to open a certain template renders it correctly. The second renders it with a broken layout. The template I test, has many
    regions and their "MoveRelativeTo" protperty seems not to work in the second case. The regions simply keep their original design
    positions wich in most of the cases leads to overlapping.
    I don't use any event handlers.

    Regards,
    Christo
  • edited January 2002
    Looks like the ShiftRelativeTo tries to establish a relationship to shift
    relative to the subreport in the other report component. Since the template
    is loaded onto the same form, it finds the ShiftRelativeTo component on the
    form, except that it is in the other report. To workaround this, after both
    templates are loaded, reassign the ShiftRelativeTo compnents in the report
    which lastly loaded the template.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited January 2002
    Hi,
    I've checked it and it seems that the regions' ShiftRelativeTo properties of the second report are totally lost.
    How can I restore them?

    Regards,
    Christo


  • edited January 2002

  • edited January 2002
    Hi,
    Thanks for the info. I have already found a workaround. I just wanted to know, if it was my error, or was it "the normal" behaviour.
    Can you tell me, why this happens? Can this be fixed, or is there no possibility to do it?


    Regards,
    Christo
  • edited January 2002
    You aren't doing anything right or wrong, per se, the streaming technology
    simply doesn't exist to handle this case, yet:) We recommend never using
    two report objects, and then load the same report onto them, if the reports
    share the same owner. When you use two report objects on a form, and load
    the same template into them at Delphi design time, you can have a look at
    the interface section of the form or look at the dfm. You'll see that the
    naming conflicts are 'resolved' on all of the report objects in the second
    report that you loaded the template into. This will cause problems since
    all of the objects in the second report are different than what they were
    saved with in the template. When any of the properties of an object in the
    second report try to resolve an object name into an object reference, it
    will get assigned an object reference of an object in the first report
    (incorrect). The streaming logic doesn't handle the case where the names
    are resolved upon loading of the second template.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited January 2002

  • edited January 2002
    Thanks to both of you.

    Christo


This discussion has been closed.