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

Create Component...

edited February 2003 in General
I need to know the parent (ie. report parent) of a newly created sub report,
either at the CreateComponent or ValidateComponent time(tppDesigner) as I am
performing some code here that require me knowing the parent at this time.
Unfortunately the ReportParent property is jsut returning null.

Anyone's advice???

--
Regards

Conrad Rowlands
Callards Technology Ltd

Comments

  • edited February 2003
    The parent of a subreport is going to be the band. Access the subreport's
    Band property. If you want the TppReport object, access the
    Subreport.MainReport property.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited February 2003
    But if the report is a subreport of a subreport then that will not be
    correct.....

    --
    Regards

    Conrad Rowlands
    Callards Technology Ltd

  • edited February 2003
    Start an empty project.

    Drop a TppReport on a form.

    Open the report designer in Delphi.

    Drop a TppSubreport in the report in the detail band. This should be called
    ppSubreport1.

    Go into the workspace of ppSubreport1.

    Drop a TppSubreport in the detail band of ppSubreport1. This should be
    called ppSubreport2.

    Then add a button on the form, an OnClick event handler and code this:

    showmessage(ppSubReport2.Parent.ClassName); {TppDetailBand}
    showmessage(ppSubReport2.Band.ClassName); {TppDetailBand}
    showmessage(ppSubReport2.Report.MainReport.Name); {ppReport1}
    showmessage(ppSubReport2.Report.MainReport.ClassName); {TppReport}

    The results I get are to the right in the comments.

    PpSubreport 2 is parented by ppSubreport1's detail band. Accessing the
    MainReport property of the nested ppSubreport2.Report, will return the
    TppReport which is ppReport1 on the form.

    Does this test fail for you?

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.