How to set the master-detail by code ?
Hi
I have a master/Detail raport - and it works fine.
When i try to changes this to work with setup in code, i can't set the
master/detail part
I do the following
ppDBPipeline1.MasterDataPipeline := ppDBPipeLine2;
ppDBPipeline1.MasterFieldLinks := FieldToLinkOn; // ex. Both DBpipeline
has a field called 'page', both is sorted on page
My result is a get on row from Pipeline2 and all the row from Pipeline1 for
each times the is a Pipeline2 row.
any ideas
Regards
Per Jungersen
I have a master/Detail raport - and it works fine.
When i try to changes this to work with setup in code, i can't set the
master/detail part
I do the following
ppDBPipeline1.MasterDataPipeline := ppDBPipeLine2;
ppDBPipeline1.MasterFieldLinks := FieldToLinkOn; // ex. Both DBpipeline
has a field called 'page', both is sorted on page
My result is a get on row from Pipeline2 and all the row from Pipeline1 for
each times the is a Pipeline2 row.
any ideas
Regards
Per Jungersen
This discussion has been closed.
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.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com