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

Region not showing records of subreport

edited October 2004 in Subreports
I have a rather strange problem - using RB 7.04 Pro with Delphi 7/ADO on MS
SQL Server at work.

The report is linked to a master pipeline MP.

Several fields from the master pipeline are placed into various sequential
regions of the report's detail section.

There is also a small number of other pipelines that are linked to the main
pipeline in the master/detail relationship, say DP1, DP2, DP3.

Fields from the detail pipelines are used in subreports and these subreports
are placed sequentially in other regions of the report's detail section.

So far so good, everything works OK.

However as I keep placing these regions containing subreports on the main
report (about 6 of them) I get to a point where the subreport shows no data
even though I know there is some data to be shown.

For example say I have a region A, followed by region B then C and D.
Region A contains fields from the master pipeline MP, so does region B.
Region C contains a subreport which uses data from the detail pipeline DP1
and region D contains another subreport which uses data from the detail
pipeline DP2.

So far so good.

But then I create another region and a new subreport linked to detail
pipeline DP3. And now this subreport shows no data even though I know there
definitely is some data.
OK, I am thinking maybe something is wrong with this new region/subreport so
I delete it and then I copy and paste the entire region D (which works)
sequentially following the original region D and I call it say E. And the
copy - region E - does not work either, it shows no data even though it was
created by simply copying an existing working region!

What could be causing this problem?

I then tried copying region A (which contains only fields from the master
pipeline and no subreports) and placing it sequentially following region E
and this new region I call it F works OK.

I spent several hours today trying various things but nothing worked.

One other thing I noticed is that when I link a pipeline to a the master
pipeline and then immediatelly select and link several DBText components in
the designer, they show values while I keep dropping them on the report.
But when I go to preview they show nothing and then when going back to the
design tab they are all cleared. I have to delete the master/detail fields
for the pipeline and recreate them to see the values again. This is true
only for the region/subreport E that shows no data, regardless of wheter I
created it from scratch or copied it from an existing one.

I really hope someone will be able to help with this one, because I already
spent hours on this without any success.

Thank you,

Peter

Comments

  • edited October 2004

    1. Make sure that you are not linking on Guid fields - this is a feature
    that is not supported in RB 7.04, it is being added to the next release.

    2. For each detail datapipeline, try setting SkipWhenNoRecords to False.

    3. Make sure that you do not have any event-handler code that manipulates
    the datasets while the report is generating.


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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2004
    Thank you for your help.

    1) I am linking an Integer field so that should be OK.

    2) OK, I will try this but I doubt it will help. As I mentioned I create a
    new region/subreport B by copying and pasting region/subreport A and while A
    is showing some records, B is blank.

    3) This happens even in RB designer when i select the Preview tab, so no
    code is involved at that point.

    What I don't understand is that it works for one region, but even when I
    simply copy and paste the same region it does not work.
    How could that be? Does that mean that when the report is previewed the
    first region's pipeline is traversed and then possibly stays on the last
    record so the subsequent region does not see any data?
    Come to think about it it can't be the problem because even when I create a
    completely new pipeline and region/subreport I get the same problem.



  • edited October 2004

    Perhaps the copy/paste is producing the problem.

    Try creating a second region and subreport without copy/paste.

    Also, make sure Region2.ShiftRelativeTo is set to Region1

    If you would like to submit an demo, please create a simple example using
    standard Delphi components, ReportBuilder and the DBDemos data. Email in zip
    format to support@digital-metaphors.com and we can check it out here.




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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2004
    I have solved the problem, well sort of.

    Instead of linking pipes in the master/detail relationship, I linked the
    datasets.
    And that helped to solbve the problem.

    It must be something to do with pipes I guess.

    Thank you for your help.


  • edited October 2004

    When using the datapipeline linking the detail dataset must be sorted on the
    linking field(s)


    ------------------------------------------------------
    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
This discussion has been closed.