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

Posted by Mason Wheeler on Stack Overflow See other posts from Stack Overflow or by Mason Wheeler
Published on 2010-05-07T00:25:10Z Indexed on 2010/05/07 0:28 UTC
Read the original article Hit count: 929

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?

© Stack Overflow or respective owner

Related posts about delphi

Related posts about reportbuilder