Home Subreports

How do I make Master/Detail subreports come out right?

edited May 2010 in Subreports
I've got a report in ReportBuilder that's supposed to report on two objects.
I didn't create this report, and I can't ask the person who did about how it
works. Before running the report, we have some code that goes through, finds
all the properties on the objects, and loads them into a memory dataset that
looks like this:

OBJECT_ID: TStringField
PROP_NAME: TStringField
PROP_VALUE: TStringField

The report engine then creates a line on the report for each property in
this dataset. This is implemented in a sub-report, whose parent only
contains an OBJECT_ID, which is a human-readable name.

Everything was going great until we had to display a "comment" of arbitrary
size in the report. I made a second sub-report with a TMemoField so it could
hold the text, and set the report up in the report designer.

What I expect when I run the report is something that looks like this:

HEADER
Object 1 properties
Object 1 comment
Object 2 properties
Object 2 comment

I've managed to get just about everything but that. I used the
MasterDataPipeline and MasterFieldLinks properties of the sub-report's
pipelines to try to link the OBJECT_IDs of the sub-reports to the OBJECT_ID
of the header, and that's the closest I've managed to come, but now what I
see is:

HEADER
Object 1 properties
Object 1 comment
Object 2 comment

The "Object 2 properties" section is nowhere to be seen, even though I've
manually verified that the data is making it into the dataset correctly.

This is driving me nuts. Any ReportBuilder gurus out there know what's going
on and now to fix it?

Comments

  • edited May 2010
    Hi Mason,

    Where is the "comment" information coming from? The same dataset as the
    object properties? If so, you will not want to create a separate subreport
    just for the comment, the comment will need to go into the original first
    subreport (perhaps in the Summary band). Then you will have something that
    looks like the following...

    Object X
    PropName PropValue
    PropName PropValue
    PropName PropValue
    Comments

    Object Y
    ...

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2010
    > I've managed to get just about everything but that. I used the

    be sure that the properties for the MasterDataPipelne are assigned at run
    time. I find that if I close a DFM and reopen it, it is always lost. (DM
    hasn't been able to reproduce it). I have code in my app that readds it each
    time, e.g.:

    plDBDetailData.MasterDataPipeline := plMasterData;


    what type of pipelines are you using? DB, JIT, other?

    Ed Dressel
    Team DM
  • edited May 2010
    No, they're coming from a separate dataset.

  • edited May 2010


  • edited May 2010
    >> what type of pipelines are you using? DB, JIT, other?

    you are linking the datasets at all? there should be no links. AFAICR the
    master ids (and detail ids) need to be in assending order, unless the link
    is explicity set to decending.

    Ed Dressel
    Team DM
  • edited May 2010
    Hi Mason,

    Ok, I have a better idea of what is happening. If you are using Child style
    subreports, you need to be sure the "Comments" subreport is set to
    ShiftRelativeTo the "Object" subreport. Otherwise they could overlap
    eachother.

    Also, I assume each detail dataset (Objects and Comments) are linked to the
    same master field and are ordered by that field.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.