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

subreport group header/footer

edited May 2004 in Subreports
Hi,
I have a subreport that is grouped by an ID field and there are 15 ID's so
its printed 15 times and spans across 3 pages.
Problem is, in the Preview window:
- page 1 comes out fine
- page 2 comes out without the Group Header and Footer(apart from the
first report)
- page 3 comes out fine

when I navigate back from page 3 to page 2, page 2 prints correctly, i.e,
the Group Header/Footer gets printed as it should...any idea as to why?

RB 6.03
Delphi 6.0

Comments

  • edited May 2004

    As a test try commenting out all event-handler code that is associated with
    the report. Make sure that you do not have any code that manipulates the
    dataset in any manner while the report is generating.

    if you have a master/detail linking relationship, make sure that it is
    deinfed properly.


    ------------------------------------------------------
    Tech Tip: Linking SQL Queries for Master/Detail Data
    ------------------------------------------------------

    The following example shows two options for linking SQL queries to create a
    master/detail relationship.

    In this example, we are using Delphi's DBDemos data to create a
    Customer/Order relationship. Thus we wish to link the Orders detail to the
    Customer master.

    I. Delphi Query Linking
    ------------------------

    a. Set the detail TQuery.DataSource property to point to the master
    query's TDataSource component.

    b. In the SQL "Where" clause for the detail query use a ':' followed by
    the linking field name from the master:

    example
    select *
    from orders
    where orders.CustNo = :CustNo

    Now each time the master record position changes, the detail query will
    automatically be refreshed with the correct result set.


    II. RB DataPipeline Linking
    -----------------------------

    a. Set the detail DataPipeline.MasterDataPipeline to point to the master
    DataPipeline.

    b. Use the detail DataPipeline.MasterFieldLinks property to define the
    linking relationship

    c. In the SQL for the detail, retrieve all records and sort them by the
    linking master field:

    select *
    from Orders
    order by CustNo


    Notes:

    1. Using RB DataPipeline, each query is executed only a single time - thus
    performance is much faster.

    2. RB Professional and Enterprise Editions include a visual Data environment
    for creating SQL queries, defining linking relationships, and creating
    Ask-At-Runtime parameters. Using the RB tools you could create the above
    linked queries in about 10 seconds.


    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com


    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited May 2004
    Hi Nard.
    I did that. I group it by a label field that has the ID. I set the
    .Caption in the OnPrint event of the label so for each ID, its a different
    Caption each time it fires and therefore I get my groups correctly(on Page 1
    at least).
    I stepped though my code and when its printing Page1, the OnPrint fires for
    the first 5 ID's and the page fits 4 reports so those print correctly. When
    I preview Page2, the OnPrint fired only once and it brought up the report
    without the GroupHeader/Footer - which is probably why it doesn't show me
    the groups because the ID's are not there...

  • edited May 2004
    managed to fix it, I had the label it was grouping by in the Group Header,
    moved it to detail band and works fine now.
  • edited May 2004

    If you Group on a Label or Variable use the OnGetText event rather than
    OnPrint or OnCalc. Due to timing of event firing, the OnGetText will work
    much better.


    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited May 2004
    oh ok, thanks for that.

This discussion has been closed.