Home Subreports

subreports with multple datalines

edited October 2007 in Subreports
D2006 RB 10.06 XPPRO SP2

We studied RB tip sheet for master/detail.
We have master with pipeline A data fields from A in detail band.

in same master detail band we have subreport with pipeline B
In subreport detail band we have data fields from pipeline B
We have group set on master to change page.

Our traverse code links SQL data sets.
We can see by debug display the fetch of two data sets for subreport.

However on sub-report detail we get only the last of two data sets. We have
tried pipeline B traverse all data flag.
No help.

If we have one data set for subreport fine. but we will have 1 to 15 or so
data sets for pipeline B and one master data set.

Comments

  • edited October 2007
    Hi Ken,

    How are you linking your datasets? Are you using DADE or placing pipelines
    on a form? Which database and connectivity are you using? If you are
    placing pipelines on a form, you need to be sure your master and detail
    dataset is ordered on the linking field. Take a look at the master-detail
    examples located in the \RBuilder\Demos\1. Reports\... directory for a demo
    of how this is done.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2007
    Ken:

    Be sure your detail pipeline traverses **all** the data--don't filter
    it--and the primary order is the same field that the master field is ordered
    by.

    Edward Dressel
    Team DM
  • edited October 2007
    Thanks
    We are doing all linking etc using Interbase SQL . We are not using DAR or
    RAP
    when we filter like from dataset for subreport i.e. only want 'green' data
    then do not get all the proper
    data. When we turn off filtering then we get multiple data for subreport.
    Like what we want except has extra data that does not belong to master.
    We have many reports with one pipeline and complex filtering using IB SQL
    and calculations while traversing .. works like we want. The master with
    pipeline A and subreport pipeline B and filtering does not work like we
    want.

    What I don't understand is the operation of traverse pipeline.
    We put debug display and EVERY time for master page we see multiple times in
    traverse event. Seems like if master data set has 1,2,3,4 .
    while traversing master pipeline our debug display should see 1 then next
    master page see 2 then next page see 3 etc.
    We see 1,2,3,4 before each master report page. does traverse take place
    PRIOR to ppReport.print?
    Thanks for any help we are dead in water with simple report.





  • edited October 2007
    Hi Ken,

    My first suggestion would be to try Datapipeline linking for your
    master-detail relationship rather than trying to link your datasets
    directly. This can be done simply by assigning the MasterDataPipeline
    property of the detail datapipeline to the master pipeline and then defining
    the MasterFieldLinks. You will need to be sure both datasets are ordered by
    the linking field(s) so RB will know which details to print for each master.
    Have you had a look at the Master-Detail demos I mentioned in my earlier
    post? See the article below for more information.

    ------------------------------------------------
    TECH TIP: Fundamentals of Report Data Traversal
    ------------------------------------------------


    1. Single Table Listing Report

    Assign the Report.DataPipeline property and leave the
    DetailBand.Pipeline unassigned.

    The report will traverse the data from start to end (based on the
    datapipeline range settings and honoring any filters you've placed on
    the datset etc.)


    2. Master/Detail Report:

    A. Assign the Report.DataPipeline property to the master. Create a
    subreport in the detail band and assign the childreport.DataPipeline to
    the detail datapipeline.

    Use either the visual linking features available from the Report
    Designer's Data tab, or Use standard Delphi dataset linking to define
    the relationships between the datasets.

    The Report will traverse the master records and for each, the subreport
    will traverse the detail data related to the master.


    3. Master with 2 Details

    Configure as in 2 above. Add an additional subreport to the detailband.
    Set subreport.ShiftRelativeTo property to the point to the first
    subreport. Connect the ChildReport's DataPipeline to the detail data.


    4. Report connected to no datapipelines.

    When Report.AutoStop is set to True, the Report will print a single
    detail band.

    When Report.AutoStop is set to False, the Report will print detail bands
    until instructed
    to stop. You can control when the report stops by setting the
    Report.PageLimit property or by calling Report.DataTraversalCompleted
    method. Otherwise the report will never stop.


    Additional Notes:
    ----------------

    1. SubReports have a Report property that is of type TppChildReport.
    Thus, programmatically you can code SubReport.Report.DataPipeline :=
    myDataPipeline.

    2. ChildReport's traverse data following the same rules as above. A
    ChildReport prints in its entirety each time it gets a turn to print.

    3. For a Child style SubReport use the Title/Summary band rather than
    the Header/Footer (or use a GroupHeader/GroupFooter combo). A standard
    Header/Footer will not work because these always print at the very
    top/bottom of the page.

    4. Do not filter the dataset or modify it any way once the report.Print
    command is issued. If you need to do master/detail and cannot use
    linked datasets, then use the master DataPipeline.OnRecordPositionChange
    event to filter the detail dataset.

    5. The reports and datapipelines use dataset bookmarking. Make sure
    the dataset can support bi-directional navigation.



    Check out the RBuilder\Demos\Reports\Demo.dpr project. Reports 0071,
    0072, 0073 show examples of master w/mutliple detail style reports.
    Number 0072 has two detail reports.


    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2007
    I now see our issue with traverse pipelines and master/detail.

    We stripped out down to basic operation on test job.

    With NO master group page break master pipeline loops (traverse) one loop
    for each data set, all on one page. Just like we figured.

    However in master with group page break on 'data' set this is loop sequence
    in our test job
    Each time in loop we are setting local variable from query cursor setting.
    loop count 1 data '3' print first page for '3'.
    loop count 2 data '3' - no print
    loop count 3 data '4' - print next page for '4'.
    loop count 4 data '3' - no print
    loop count 5 data '4' - no print
    loop count 6 data '5' - print next page for '5'.
    loop count 7 data '3' - no print - ending

    I am speculating extra loops for group/look ahead functions or we have
    master pipeline parameter wrong..


    The detail traverse loops in sequence once per data like we figured.

    Nick .. yes using RB linking allows master and detail to print as wanted.
    We will just need to perform our 'background' calculations without using
    master traverse section.

    Thanks for your help and thoughts.

    Ken Thompson
  • edited October 2007
    I now see our issue with traverse pipelines and master/detail.

    We stripped out down to basic operation on test job.

    With NO master group page break master pipeline loops (traverse) one loop
    for each data set, all on one page. Just like we figured.

    However in master with group page break on 'data' set this is loop sequence
    in our test job
    Each time in loop we are setting local variable from query cursor setting.
    loop count 1 data '3' print first page for '3'.
    loop count 2 data '3' - no print
    loop count 3 data '4' - print next page for '4'.
    loop count 4 data '3' - no print
    loop count 5 data '4' - no print
    loop count 6 data '5' - print next page for '5'.
    loop count 7 data '3' - no print - ending

    I am speculating extra loops for group/look ahead functions or we have
    master pipeline parameter wrong..


    The detail traverse loops in sequence once per data like we figured.

    Nick .. yes using RB linking allows master and detail to print as wanted.
    We will just need to perform our 'background' calculations without using
    master traverse section.

    Thanks for your help and thoughts.

    Ken Thompson


This discussion has been closed.