MasterDatapipe in master detail report
I have seen in the help file about MasterDatapipeline "For the DBPipeline
and BDEPipeline classes this property is informational only", Is this really
that we can left it blank (and also the MasterFieldLinks property) and still
can generate a master-detail report for .rtm file? Or how to create a .rtm
for a master-detail report with two query (two pipeline)?
and BDEPipeline classes this property is informational only", Is this really
that we can left it blank (and also the MasterFieldLinks property) and still
can generate a master-detail report for .rtm file? Or how to create a .rtm
for a master-detail report with two query (two pipeline)?
This discussion has been closed.
Comments
The help on this topic is a little misleading. It implies that since the
MasterDataPipeline property is informative, you should not use the
MasterFieldLinks property at all with a DBPipeline. This is not true.
There are two different ways to link queries in a Master/Detail
relationship. One using Delphi Parameter linking and the other using
ReportBuilder DataPipeline linking. I recommend using the latter. See the
article below for more information.
------------------------------------------------------
Tech Tip: Linking SQL Queries for Master/Detail Data
------------------------------------------------------
The following example shows two options for linking SQL queries to
create a master/detail relationship.
In this example, we are using Delphi's DBDemos data to create a
Customer/Order relationship. Thus we wish to link the Orders detail to
the Customer master.
I. Delphi Query Linking
------------------------
a. Set the detail TQuery.DataSource property to point to the master
query's TDataSource component.
b. In the SQL "Where" clause for the detail query use a ':' followed by
the linking field name from the master:
example
select *
from orders
where orders.CustNo = :CustNo
Now each time the master record position changes, the detail query will
automatically be refreshed with the correct result set.
II. RB DataPipeline Linking
-----------------------------
a. Set the detail DataPipeline.MasterDataPipeline to point to the master
DataPipeline.
b. Use the detail DataPipeline.MasterFieldLinks property to define the
linking relationship
c. In the SQL for the detail, retrieve all records and sort them by the
linking master field:
select *
from Orders
order by CustNo
Notes:
1. Using RB DataPipeline, each query is executed only a single time -
thus performance is much faster.
2. RB Professional and Enterprise Editions include a visual Data
environment for creating SQL queries, defining linking relationships,
and creating Ask-At-Runtime parameters. Using the RB tools you could
create the above linked queries in about 10 seconds.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
relationships" because I don't want to set the adoquery active to true in
design time, is there any method that I can just use keyboard to define the
linking relationships?
By using the "keyboard" to define the linking relationships, I assume you
mean in code. See the article below...
---------------------------------------------------------
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.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com