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

MasterFieldLinks at runtime

edited May 2002 in General
Is it possible to set the MasterFieldLinks property of a TppDBPipeline at
runtime?
If so how is it done?
MyPipe.MasterFieldLinks := MyMasterField=MyChildField; ?

or what other way

Bill

Comments

  • edited May 2002
    Please see the information below as well as the following demo.

    http://www.digital-metaphors.com/tips/MagicMasterDetail.zip

    ---------------------------------------------------------
    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,

    Alexander Kramnik
    Digital Metaphors

  • edited May 2002
    Alexander,
    Thank you for the response. However I have come up with the following
    workaround.
    For the subreport that will be showing all of the child records I did the
    following.
    In the Detail of the SubReport I put the following on the BeforePrint event.

    Detail.Visible := ChildPipeline['LinkField'] = MasterPipeline['LinkField'];

    It works pretty fast and I don't need to order them (even though I do).

    This way it only opens the master and child query once and the results are
    the same.

    Bill


    "Alexander Kramnik (Digital Metaphors)" wrote
This discussion has been closed.