Was this helpful?
The master_detail Template
Like the simple_field and table_field frame templates, the master_detail frame template creates a database table browser. However, primary-detail frames perform two queries that exist in a one-to-many primary-detail entity relationship. The primary query, which queries one or more joined tables, is used to populate the primary portion of the frame; the detail query, which can also query one or more joined tables, is used to populate the detail portion of the frame.
Note:  Frames generated from this template can call frames generated from the detail or explosion frame templates.
Create a primary-Detail Frame
You can create a primary-detail frame using the master_detail frame template.
To create a frame using the master_detail frame template
1. On the Develop tab, select the application in which you want to create the frame in the Applications portlet, and then select the header bar of the Components portlet to make it active.
2. Click File, New, User Frame.
The Create User Frame dialog appears.
3. Enter the component name in the Name field (for example, My_Master_Detail).
4. (Optional) Enter a comment for the component in the Remark field.
5. Select mastdetl from the Application list and the master_detail template from the Template list.
6. Click Create.
The Select Database Object dialog appears.
Note:  The Select Database Object dialog displays two entry fields instead of the usual one.
7. Enter the name of the primary table in the Master entry field.
8. Repeat this procedure for the primary detail table using the Detail entry field.
For more information about using the control button to the right of the entry field to specify a table, see Table Selection Dialog.
9. Click OK.
The Frame Assistant appears:
10. Click the join icon in the query display area.
11. Before generating the primary-detail frame, you must define one or more join columns between the two tables. Then click Insert to create a join.
A line is drawn between the two columns indicating the join.
For more information, see How You Can Define Join Column Properties.
12. Using the Frame Assistant, you can optionally specify additional tables, including lookup or associate tables. You can also select query expressions, query properties, and display properties for result columns.
For more information, see:
13. Click Generate.
If the tables you specified have “updatable” columns but no key, an Information dialog appears.
14. Click OK to continue.
The primary-detail frame is created and displayed in the Frame Editor.
Note:  An Open Row and an Open List button are provided in the Frame Editor. They will appear in the running frame only if the primary-detail frame is selected as the parent frame to either an explosion or a detail frame (for more information, see Create an Explosion Frame) or Create a Detail Frame).
15. (Optional) Specify the frame's properties using the Property Inspector.
For more information about using the Property Inspector, see Set Frame Properties.
How You Can Use a Primary-Detail Frame
The generated primary-detail frame displays a primary and a detail section. The primary section of a frame is used to display a single row passed to it from a calling frame's detail table field. It consists of a set of VCR buttons and a slider to navigate through each selected row, with its values updated automatically in a matrix of fields. Each field is mapped by name and type to the result columns of the primary query.
The detail section of a detail frame is used to display the rows of a second query of one or more joined tables that are associated with the primary query. It contains a table field, each of whose columns maps by name and type to the result columns of the detail query.
To see the primary-detail frame in operation, click Debug, Go on the floating menu bar.
Primary Query Table Operations
The Form menu provides commands to enable the user to perform standard database operations on the primary query table, such as inserting a new row, duplicating a row, and saving the changes to the table. It also enables you to perform a query or sort the data in the primary-detail frame. For more information about sorting and querying, see How You Can Use a Simple Field Frame.
Detail Query Table Operations
As the user is navigating between rows of the primary query, the table field in the detail section of the frame is automatically populated with those rows in the detail query associated with the current row in the primary section. The Row menu commands also perform standard database operations on the detail database table, such as adding a new row, duplicating a row, finding text, and copying the table. (For more information about how to find text and copy a table, see Use a Table Field Frame).
A new table can also be created by clicking Form, New. To enter new data, click the control button and select Create First Row. For information about editing data in a table, see Use a Table Field Frame.
Synchronous or Asynchronous Frame Processing
In the primary-detail frame, keeping the data in the parent and explosion or detail (child) frames “in sync” could be a tedious job. However, using The OpenROAD frame templates, it is handled seamlessly by the frame's synchronization mode.
By default, the generated frame is synchronous, which means that the parent and child frames are both updated when a change is made in either frame. In asynchronous mode, the parent and child frames operate independently.
To make the frame asynchronous, click the control button and then clear Synchronous Detail Frame from the option menu, removing the checkmark.
When the parent frame is in asynchronous mode and the explosion or detail frame is displayed, its VCR buttons do not appear. There is no need for the parent and child to remain synchronized, so these buttons are not necessary. Thus, the presence of the VCR buttons on the explosion or detail frame is dynamic, depending on a selection made at runtime.
Last modified date: 06/25/2024