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

Runtime subreports loading.

edited April 2007 in Subreports
?Ciao,

The main report prints a page for every record with some fields.
At the end of each page, it may be necessary to print a subreport (or
even more) if the value of some special fields determine to do so.

I put an empty subreport in the outer GroupFooterBand, set the
PrintBehavior to pbSection and I wrote this code on the BeforeGenerate
event:

=========================================================================
procedure TfrmVerbali3.ppGroupFooterBand1BeforeGenerate(Sender: TObject);
begin

ppSubReport1.Visible := true;

with ppChildReport1 do begin

if ( ppDBPipeline['specialfield'] = 1) then
Template.FileName := Application.GetNamePath + file1.rtm'

else if ( ppDBPipeline['specialfield'] = 2) then
Template.FileName := Application.GetNamePath + file2.rtm'

{...and so on...}
else

ppSubReport1.Visible := false;


Template.LoadFromFile;

end;

end;
====================================================================

It works for the first two records that trigger the dynamic sub report
and then either raise an exception or prints blank pages.

Can you help me?

Thanks

Fabrizio.



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited April 2007
    Hi Fabrizio,

    Where in the code below is the AV occuring? Try setting your library path
    to \RBuilder\Source\... and trace into the ReportBuilder source code and see
    where the problem is occuring. If you would like, please create a simple
    example that demonstrates the problem and send it 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
This discussion has been closed.