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

2 reports combined in one, 2nd report generation never ends

edited September 2007 in General
Hi!

I have one report that is combined from two reports in third report. This
third report has 2 subreports where in methods SubReportOnPrint dynamically
loaded its report with the following code:

procedure TdmObracunPrint.ppSubRacunPrint(Sender: TObject);
//first report
var
sReport : String;
begin
sReport := glSkupno.ProgramData.MapaReport;
sReport := IncludeTrailingPathDelimiter(sReport) + 'Obr_Pror_racun.rtm';
with TppSubReport(Sender).Report.Template do
begin
FileName := sReport;
LoadFromFile;
end;
end;

procedure TdmObracunPrint.ppSubSpecPrint(Sender: TObject);
//second report
var
sReport : String;
begin
sReport := glSkupno.ProgramData.MapaReport;
sReport := IncludeTrailingPathDelimiter(sReport) + 'Obr_Pror_spec.rtm';
with TppSubReport(Sender).Report.Template do
begin
FileName := sReport;
LoadFromFile;
end;
end;

The first subreport shows up okay (and can also be printed), while the
second shows but the RB is calcuating the page indefinitely or even causes
access violation. If I try each report individually, there are no problems
and they show up and print as expected. I tried AutoStop both on true and
false, one or two passes, no good.
I use RB 10.06 with BD2006 and MS SQL2000/2005 through dbeXpress driver.

Does anybody have any idea?

Best regards,
Goran Brumen
Audax d.o.o.

Comments

  • edited September 2007
    Hi Goran,

    What type of subreports are you using (Section, Child, Fixed)? Are you able
    to manually load each template into the empty subreports and run the report?
    What happens if you load the two templates before the entire report is
    printed?

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2007
    Hi Nico!

    The joint report, which include two subreports with mentioned code, has
    subreports of PrintBehavior = pbSection. I haven't checked other options
    though.
    Since I load reports from delphi code instead of RAP (is it possible, if
    yes, how?), how can I load both templates in this joint report? I can
    manuall load each one and view and print individually, no problem.
    If I run the application (in BDS2006) and load this joint report, report 1
    (that is invoice summary) shows okay, then Access Violation at adress 622FE1
    (in modules this should be TppReport.GenerateoutlineDrawCommand). After
    click on okay button page 1 can be printed (page 1 of 1). Switching to
    second page (and thus second report - detail invoice) generates AV again at
    the same address and then it calculates and calculates and calculates....
    If I want to print this second report alone, everything is normal and I
    can't figure it out what's wrong. Maybe shall I send You on mail those three
    reports, clientdataset's XMLs?

    Best regards,
    Goran


  • edited September 2007
    Hi Goran,

    Yes, if possible, please send an example I can run on my machine to
    support@digital-metaphors.com and I'll take a look at it for you.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2007
    Hi Nico,

    I sent You the sample yesterday on e-mail. I hope the sample provided will
    be okay.

    Best regards,
    Goran Brumen
    Audax d.o.o.


  • edited September 2007
    Hi Goran,

    Thanks for the example. I sent a reply with an updated version of your
    example.

    --
    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.