Master-Detail-Detail
I got a problem when doing Master-Detail-Detail. I got Master Report then
add a SubReport at detail band. Then add another SubReport into the first
SubReport detail band. When i previwe a single master record, let said
A00001, all the subreport result is correct. When i preview more than 1
master record, let said A00001 to A00002, the result of the A00001 is
correct but the result of A00002 is wrong. But if i only preview A00002, the
result is correct. What could i possible did wrong?
Regards, Phong
add a SubReport at detail band. Then add another SubReport into the first
SubReport detail band. When i previwe a single master record, let said
A00001, all the subreport result is correct. When i preview more than 1
master record, let said A00001 to A00002, the result of the A00001 is
correct but the result of A00002 is wrong. But if i only preview A00002, the
result is correct. What could i possible did wrong?
Regards, Phong
This discussion has been closed.
Comments
- check that the data linking relationships are properly defined - see tech
tip article below
- check that the main report and childreport DataPipeline properties are
properly assigned
------------------------------------------------------
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.
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
correct. And check the tech tree before and compare lines by lines, don't
seen anything wrong.
The main and child report DataPipeline is assign correctly.
Suspect is the report format problem. Can send you the Report Format?
- make sure that you either use DataSet linking or DataPipeline, but not
both
- see RBuilder\Demos\Reports\Demo.dpr for examples of master/detail/detail
- if you would like to submit an example for review, please email in zip
format to support@digital-metaphors.com, a runnable example is preferred -
you can create an example using the DBDemos data or the sample Interbase
data
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
cause the problem. Thanks for your support.