Master-detail relationships are commonly used in applications.
An example of this type of relationship is an order with a header
and line items. In PHPRunner you can join, or link, two or more
tables that have at least one common field. You can Add/Edit
records in the master-detail tables on the same page.
Note that one master table can have multiple detail tables. And
you can display data from multiple detail tables (nested or one
master - many details) on the same page. I.e. you can display customers,
orders by customer, order details per order and edit all three
tables at the same time without leaving the page.
To create master-detail relationship in PHPRunner:
1. Go to the Datasource
tables page and select both master and detail tables in the
list of datasource tables..
2. Drag and drop field from one table to another. Table link properties dialog opens.
3. Choose what table is Master and select link fields in both
tables. If you'd like to display master table info on the Details
page select the corresponding check box. Click OK. See examples of Master page and
Details page settings below.
Preview detail records in
Note: If you
select to display detail records in popup, you can define the popup
page appearance in Visual
Editor -> Details
preview page for detail table.
Preview detail records
If you select to display detail records inline, you will be able
to add/edit/delete details in inline mode on master table.
Display detail records on the
Display master table info on
the Details page:
4. Now master-detail relationship is created and displayed as
arrow between tables.
If one master table has two or more detail tables, you can order
detail tables as well as select their location (vertical or
horizontal). To do this, click the button to open context menu of master
table and select the Details
tables order. The same dialog is available via
right-clicking the link between tables.
For more information, see Master-detail
Charts and reports as
master and detail tables
Now you can use charts and reports as both master and detail
Chart as detail table:
Chart as master table:
Report as details table: