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

Section Reports in MainReport - wrong Order and ChildBehavior

edited August 2005 in Subreports
Hello,

I need your help! I try to take two or more subreports into one main
report. The Main report has no pipeline, the subreports are user-defined
and it is possible, that they have a pipeline and that they have own
subreports with pipelines also.

I did this:


SubReport := TppSubReport(ppComponentCreate(AMainReport, Tppsubreport));
SubReport.Band := AMainReport.DetailBand;
SubReport.PrintBehavior := pbSection;
SubReport.CreateReport(AMainReport);
SubReport.ParentWidth := true;
SubReport.Visible := true;

MainChildReport := TppChildReport(SubReport.Report);
MainChildReport.Template.LoadFromStream(AMainStream);
//Take the Main Printer-Setup from the first subreport
AMainReport.PrinterSetup.Assign(MainChildReport.PrinterSetup);


for i := 0 to FAnhangObject.ChildList.Count - 1 do
begin
SubReport := TppSubReport(ppComponentCreate(AMainReport,
Tppsubreport));
SubReport.PrintBehavior := pbSection;
SubReport.Band := AMainReport.DetailBand;
SubReport.CreateReport(AMainReport);
SubReport.ParentWidth := true;
SubReport.Visible := true;
MainChildReport := TppChildReport(SubReport.Report);
ASubReportStream := GetStreamFromObject(FAnhangObject.ChildList[i]);
MainChildReport.Template.LoadFromStream(AAnhangStream);
SubReport.ParentPrinterSetup := true;
end;

The problems are:

(1) The last subreport is the first shown report.
(2) The behavior of the childreports in my section-reports is wrong. If
I have a region "under" such a childreport and I use the "Shift
relative to" property, the region is always printed over the
childreport.

If I load one of my report-streams into the main report (without creating
subreports) everything works fine.

I use Report Builder 6.03 and Delphi 6.

Do you have an idea, what I do wrong?

Thank you

Christine

Comments

  • edited August 2005
    Hi Christine,

    1. When creating multiple subreports you will need to assign the
    ShiftRelativeTo property to get the order you desire. I would recommend
    creating a TList that holds each subreport object once they have been
    created. Then once the TList is full, loop through all the subreport
    objects and set the bottom one to ShiftRelative to the next one up and so
    forth. For instance...

    for liIndex := myList.Count - 1 down to 1 do
    TppSubreport(myList[liIndex]).ShiftRelativeTo :=
    TppSubreport(myList[liIndex - 1]);

    2. This is not a known issue with ReportBuilder. Are you able to recreate
    this behavior with a simple example (i.e. creating the report visually with
    the designer)? Where are you setting the ShiftRelativeTo property for the
    region?

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2005
    Hello Nico,

    it doesn't help anything.

    The report streams, which I use, are created as "normal" main reports and
    not as subreports by the end user. If I load such a stream into the main
    report, then everything is okay.Is it possible, that the stream "knows"
    that it is the stream of a main report and it is for this reason, it
    doesn't work in a subreport?

    The "shift relative to property" is also set in the designer by the end
    user. Because I also create the pipelines dynamic it is really hard to
    try the behavior in the designer by myself.



    Thank you for answer

    Christine



  • edited August 2005
    Hello Nico,

    you can see the problem, when you create a normal report with one
    subreport and a region and save this report to a file.

    Next step ist to create a new report with a subreport as pbsection and
    load the file into this subreport. The region has lost it's "shift
    relative to" property.

    With best regards

    Christine


  • edited August 2005
    Hello Nico,

    next morning and I tried some other things:

    Order of pbSection - subreports: If the first report is in the detailband
    and all the next subreports are in the summary band of the main report
    then the order of the reports is okay.

    "Lost" Shift relative property of the region: I've download the trial
    version 9.02 and in this version the problem with the "Shift relative
    to" isn't anythere. By debugging I've seen, that in the procedure
    "TppStretchable.GetShiftRelativeTo" in the unit "ppStrtch" the Shift
    relative property is set to nil, because the shift relaive - subreport
    isn't found in the band. I think, that there is an issue by reading the
    band, on which the subreport and the TppStrechable are.

    Please, can you give me an information, what are the differences between
    versions 6 and 9?

    Thank you

    Christine




  • edited August 2005
    Hi Christine,

    Sorry, I failed to realize you were using an older version of
    ReportBuilder... usually downloading and trying the latest version that is
    my first suggestion. There are many differences between RB 6 and RB 9
    (hopefully all good). All of your existing reports should work correctly in
    RB 9. If this issue is fixed by upgrading then the behavior you are seeing
    must have been a bug that was fixed between the release of the two.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.