Home Subreports

Number of SubReports

edited July 2004 in Subreports
We are using RB 7.03 and D5 Ent.

Is there a "recommended" max number subreports that we should stay under for
performance reasons?

tia

Kevin.

Comments

  • edited July 2004

    No. That is up to you to determine. There are many factors that can affect
    performance. The complexity of the report layout is affected by number of
    subreports and also by factors such as the number of KeepTogether objects,
    Stretchable objects, etc. that appear in the report. Advanced features
    usually result have a performance component to them.

    The performance of the data access is another big factor. This is affected
    by the database product and the configuration you are using. It is also
    affected by the type of data linking you use. ReportBuilder supports two
    types of query linking. See article below...


    ------------------------------------------------------
    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 July 2004
    The only gotcha with many subreports even if invisible, is that all the
    controls on the sub-report still get processed. I have a report with nearly
    20 sub-reports with nearly a thousand db components within the report that
    get updated. Somewhere in this newsgroup there is a message that says how
    you can keep all of these not used db components from being updated, but I
    don't recall where it is. It was mentioned within the past several months.

    Jeff Kreider


  • edited July 2004

    A couple of options to try:

    1. Set the subreport.Band to nil to remove it from the report.

    2. Set subreport.DataPipeline to nil to disconnect it from the datapipeline.
    If the data-aware component in the subreport such DBText have
    ParentDatapipeline set to True, I think they will the DBText.DataPipeline
    will automatically be set to nil.




    --


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2004
    Hi Nard,
    I finally had some time to go over your suggestions you made below and I
    have some questions.
    1. If I remove the subreport from the band how am I supposed to use the
    subreport since it's no longer in the report?

    2. I set the subreport.datapipeline to nil but all of the components e.g.
    dbtext still have the datapipeline property filled, i.e. not nil. The way
    my report is setup is that the report.datapipeline is filled, all
    subreport.datapipelines = nil, and all dbtext.datapipelines <> nil. One
    report has 514 textpipeline fields and 3372 components within 16 subreports.
    Several of these subreports are within a subreport. As you may imagine it
    takes several seconds for this report to generate the first time and each
    time I go to another page. What I am wondering is do I need to select all
    514 fields and set these to nil and then some how reset only those fields'
    datapipeline back to a value that are on the subreport that I made visible?

    Jeff Kreider

  • edited August 2004

    1. The report engine will open all of the datasets associated with the main
    report, data-aware controls and childreports. If you have subreports that
    you want to conditionally suppress prior to generating the report, then you
    could remove them from the main report by setting the subreport.Band
    property to nil. To re-attach the subreport to the main report you would
    need to keep a reference to it and then re-assign the Band property. However
    you cannot do this while the report is generating (i.e. you can do it prior
    to the call to Report.Print).

    2. Each data-aware component has a ParentDataPipeline property. If
    DBText.ParentDataPipeline is True, then setting Report.DataPipeline will
    propogate the value to DBText.DataPipeline. If DBText.ParentDataPipeline is
    False, then you need to explicity set the DBText.DataPipeline property. In
    practice for a large complex report like you describe, I think you need to
    loop thru the components and explicitly assign the DataPipeline property for
    each component. You can do this be iterating thru the
    Report.Bands[].Components[] structure. For the subreports you can iterate
    over the Subreport.Report.Bands[].Components[] structure.




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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2004
    Thanks Nard for the info.

    Jeff


This discussion has been closed.