--------------------------------------------------------- Tech Tip: Define Master/Detail DataPipeline Links in Code ---------------------------------------------------------
Defining a Master/Detail relationship for a DataPipeline requires that the detail pipeline have the following properties defined:
1. MasterDataPipeline
2. MasterFieldLinks
At Delphi design-time you can use the object inspector and the DataPipeline's FieldLinks editor to define the master/detail relationship.
The following example illustrates how to define the master/detail relationship dynamically at run-time.
var lFieldLink: TppMasterFieldLink;
begin
{define the master/detail pipeline relationship} plDetail.MasterDataPipeline := plMaster;
{create a new field link } lFieldLink := TppMasterFieldLink.Create(nil);
lFieldLink.Parent := plDetail;
{assign the detail field name} lFieldLink.DetailFieldName := 'CustNo';
{assign the master field name} lFieldLink.MasterFieldName := 'CustNo';
end;
Note: The DataPipeline linking requires the records in the detail dataset to be ordered by the linking fields. In the above example, the detail data must be ordered by CustNo.
I did like this example, but I have another problem now: the report list all records from subreport's Pipeline. The subreport ignores the key from main report. Infinite pages with a last record from main report is showing. How can I do?
Take your report and get it working by building the links at Delphi design time. Make sure this is the only change. I know you probably have other code configuring this report, so leave that alone. Just move the link creation to Delphi design time. Once that is working, then try to build the links at runtime. Maybe that will help? There are master detail JIT pipeline examples in the main reports demo project that you can reference to test your code on.
Comments
Tech Tip: Define Master/Detail DataPipeline Links in Code
---------------------------------------------------------
Defining a Master/Detail relationship for a DataPipeline
requires that the detail pipeline have the
following properties defined:
1. MasterDataPipeline
2. MasterFieldLinks
At Delphi design-time you can use the object inspector
and the DataPipeline's FieldLinks editor to define
the master/detail relationship.
The following example illustrates how to define the
master/detail relationship dynamically at run-time.
var
lFieldLink: TppMasterFieldLink;
begin
{define the master/detail pipeline relationship}
plDetail.MasterDataPipeline := plMaster;
{create a new field link }
lFieldLink := TppMasterFieldLink.Create(nil);
lFieldLink.Parent := plDetail;
{assign the detail field name}
lFieldLink.DetailFieldName := 'CustNo';
{assign the master field name}
lFieldLink.MasterFieldName := 'CustNo';
end;
Note: The DataPipeline linking requires the records in the detail dataset to
be ordered by the linking fields. In the above example, the detail data must
be ordered by CustNo.
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
records from subreport's Pipeline. The subreport ignores the key from main
report. Infinite pages with a last record from main report is showing.
How can I do?
Thanks
time. Make sure this is the only change. I know you probably have other
code configuring this report, so leave that alone. Just move the link
creation to Delphi design time. Once that is working, then try to build the
links at runtime. Maybe that will help? There are master detail JIT
pipeline examples in the main reports demo project that you can reference to
test your code on.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com