Home Subreports

Sub not printing the title :/

edited December 2006 in Subreports
Hi everybody...

I have a Report without DBPipeline. It contains a Header, Detail and
Footer with no data objects.

like that:

Company Name
Report properties (Name, Date, Time)
------------------------------------------------------Header

------------------------------------------------------Detail
End of page - Software House Company
------------------------------------------------------Footer

that is a default for more than 200 reports.


The Sub contains:
(a customers report for example)


Code Customers Name
---------- ------------------------------
-------------------------------------------------------Title
intCusCod strCusName
-------------------------------------------------------Detail

ok!

The first page prints:



Customers Report 12/14/06 11:00am
------------------------------------------------------Rep.Header
|
Code Customers Name |-> Sub.Title
---------- ------------------------------ |______________
171 Luciano Pavaroti |
666 George Fuck Bush |
069 Madona |-> Sub.Detail
xxx... xxx... |
xxx... xxx... |______________
------------------------------------------------------Rep.Detail
End of page - Software House Company
------------------------------------------------------Rep.Footer


That is the problem:

The second and other pages prints:



Customers Report 12/14/06 11:00am
------------------------------------------------------Rep.Header
-> Sub.Title ?????
123 Jose Augusto |
456 Milena Gretchen |
789 Daniel Cantor |-> Sub.Detail
xxx... xxx... |
xxx... xxx... |
------------------------------------------------------Rep.Detail
End of page - Software House Company
------------------------------------------------------Rep.Footer

Note that the Sub.Title is not printing...
I cant put the Sub.Title objects in Rep.Header because my application
is a report generator and the Rep.Header and Rep.Footer, are default to
all my reports. :/
So... that's my problem: I need to print the Sub.Title in all pages
under the Rep.Header.

I tried to change the SubReport.PrintBehavior to pbSection but then the
fist page prints the Rep.Header without the Sub, and the second page
prints the Sub without the Rep.Header.


I'm from Brazil and my english is bad ;/

Thanks in advance, have a nice day...

Jose Otavio

--

Comments

  • edited December 2006
    Tks for atention, Nico.

    But i dont understand the Groups (Report\Groups... (CTRL+G))
    please, do u have an example of my case?

    no problem if u dont...
    i´m trying here.
    I am thankful for all.
    have a nice day!

    José Otavio.
    :)

    --



  • edited December 2006
    Hi Jose,

    Since Child subreports do not support page headers and page footers, you
    can use the GroupHeader/GroupFooter bands instead. If you need to repeat the
    header
    when a page breaks then then you can create a group and set StartNewPage to
    True.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    Hi Jos?,

    Here is a quick example of what I was talking about in my previous post.

    http://www.digital-metaphors.com/tips/ChildSubreportWithHeader.zip

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    Hi Nico.
    i'm very very thankful for your atention!!!

    Sorry but i´m using D7 with RBuilder 9.01
    I think that u're using another version of RBuilder

    Look... I'm trying to do in this way:
    http://img173.imageshack.us/my.php?image=imagem1xm4.jpg
    http://img173.imageshack.us/my.php?image=imagem2oc8.jpg

    It´s correct?

    I dont know if that is the best way but it works.... look:
    http://img173.imageshack.us/my.php?image=imagem3sz9.jpg


    Now... i need to do that in runtime...

    That is the old way... without groups.

    var
    oSub: TppSubReport;
    oGroup: TppGroup;
    oGroupHeaderBand: TppGroupHeaderBand;
    ...

    oSub := TppSubReport.Create(Form1);
    oSub.Name := 'Sub1';
    oSub.Band := Report1.DetailBand;
    oSub.DataPipeline := DBPipeLine_Customers;
    oSub.CreateReport(Report1);
    oSub.Report.DefaultBands := [btHeader, btDetail, btFooter];
    oSub.Report.CreateDefaultBands;

    and then, create all the others objects...

    it works but the Sub.Header stay only on the first page. (my first
    problem)

    --------------------------------

    So. After your replay, I'm trying to create the group on this way:

    oSub := TppSubReport.Create(Form1);
    oSub.Name := 'Sub1';
    oSub.Band := Report1.DetailBand;
    oSub.DataPipeline := DBPipeLine_Customers;
    oSub.CreateReport(Report1);
    oSub.Report.DefaultBands := [btDetail, btFooter]; // without the Header
    oSub.Report.CreateDefaultBands;

    oGroup := TppGroup.Create(Form1);
    oGroup.BreakType := btCustomField;
    oGroup.NewPage := True;
    oGroup.Report := oSubRelatorio.Report;

    oGroupHeaderBand := TppGroupHeaderBand.Create(Form1);
    oGroupHeaderBand.Group := oGroup;

    oSub.Report.AddGroup(oGroup);

    and then, create all the others objects...

    but it makes a exception (Access Violation) when i try Report1.Print.

    can u help me?

    have a nice day!

    José Otavio.
    :)

    --



  • edited December 2006
    (New Image Links)

    Hi Nico.
    i'm very very thankful for your atention!!!

    Sorry but i´m using D7 with RBuilder 9.01
    I think that u're using another version of RBuilder

    Look... I'm trying to do in this way:
    http://img266.imageshack.us/my.php?image=tmp176gd2.jpg

    http://img444.imageshack.us/my.php?image=tmp2984ia7.jpg

    It´s correct?

    I dont know if that is the best way but it works.... look:
    http://img279.imageshack.us/my.php?image=tmp2fy0.jpg


    Now... i need to do that in runtime...

    That is the old way... without groups.

    var
    oSub: TppSubReport;
    oGroup: TppGroup;
    oGroupHeaderBand: TppGroupHeaderBand;
    ...

    oSub := TppSubReport.Create(Form1);
    oSub.Name := 'Sub1';
    oSub.Band := Report1.DetailBand;
    oSub.DataPipeline := DBPipeLine_Customers;
    oSub.CreateReport(Report1);
    oSub.Report.DefaultBands := [btHeader, btDetail, btFooter];
    oSub.Report.CreateDefaultBands;

    and then, create all the others objects...

    it works but the Sub.Header stay only on the first page. (my first
    problem)

    --------------------------------

    So. After your replay, I'm trying to create the group on this way:

    oSub := TppSubReport.Create(Form1);
    oSub.Name := 'Sub1';
    oSub.Band := Report1.DetailBand;
    oSub.DataPipeline := DBPipeLine_Customers;
    oSub.CreateReport(Report1);
    oSub.Report.DefaultBands := [btDetail, btFooter]; // without the Header
    oSub.Report.CreateDefaultBands;

    oGroup := TppGroup.Create(Form1);
    oGroup.BreakType := btCustomField;
    oGroup.NewPage := True;
    oGroup.Report := oSubRelatorio.Report;

    oGroupHeaderBand := TppGroupHeaderBand.Create(Form1);
    oGroupHeaderBand.Group := oGroup;

    oSub.Report.AddGroup(oGroup);

    and then, create all the others objects...

    but it makes a exception (Access Violation) when i try Report1.Print.

    can u help me?

    have a nice day!

    José Otavio.
    :)






    --



  • edited December 2006
    Yeah... i search and found that procedure to create groups today
    morning!
    i'm realy thankfull for your atention, Nico!

    Regards... have a nice end of week ;)

    José Otavio

    --



  • edited December 2006
    Hi Jos?,

    Take a look at the followng article on creating groups in code. In your
    case you don't need to set a DataPipeline and you only need to group on a
    custom field.

    Then you will need to add something like the following...

    Group.BreakName := 'ppLabel1';
    Group.BreakType := btCustomField;

    ----------------------------------------------------
    Tech Tip: Creating a Group in Code
    ----------------------------------------------------


    How can I dynamically create a report group at run-time?


    example code:
    -------------

    uses
    ppClass, ppGroup, ppClasUt;


    function AddGroupToReport(aBreakName: String; aDataPipeline:
    TppDataPipeline; aReport: TppCustomReport);
    var
    lGroup: TppGroup;
    lGroupBand: TppGroupBand;

    begin


    {add group to report}
    lGroup := TppGroup(ppComponentCreate(aReport, TppGroup));

    lGroup.Report := aReport;

    lGroup.BreakName := aBreakName;
    lGroup.DataPipeline := aDataPipeline;

    {add group header and footer bands }
    lGroupBand := TppGroupBand(ppComponentCreate(aReport,
    TppGroupHeaderBand));
    lGroupBand.Group := lGroup;

    lGroupBand := TppGroupBand(ppComponentCreate(aReport,
    TppGroupFooterBand));
    lGroupBand.Group := lGroup;


    end; {procedure, AddGroupToReport}

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    The access violation

    I was trying to create Groups without the GroupFooterBand
    that generates the exception. ;)

    tks for all, Nico.

    []s

    --



This discussion has been closed.