Oracle Tips by Burleson
a Master Detail Form
A Master Detail form
includes several of the features that have been covered so far. The
Master Detail wizard will create two application pages. One page is a
report and the other has a form and a tabular form on the page. There
is the option of separating the second page into two separate pages.
At the developer’s request, the wizard will put the form on one page
with a standard report, and another page will have a form to edit a
single detail record for a total of three application pages.
For this example, the DEPT and
EMP tables will be included
with HTML DB. The DEPT table
is the Master and the EMP
table is the Detail.
The two following sequences can be used for the
population of the primary key columns of the
EMP tables. In the SQL
Workshop à SQL Commands
window, run the following SQL statements.
sequence dept_seq start with 10000
create sequence emp_seq start with 10000
Next, create the Master Detail form.
Navigate to the application home page for the Easy HTML DB Book
application and click on the Create Page button.
On the next page, choose the Form option and click Next.
On the next page, choose the Master Detail Form page and click
On the Master Table page:
Table / View Owner:
Table / View Name:
For the Available Columns, select the icon
to move all columns to the Displayed Columns list, and then click
On the Detail Table page:
is the only table in the select list. This is because the Show
Only Related Tables item is set to YES. Therefore, only tables
having a foreign key relationship to the Master (DEPT)
table will be in the select list. If there is no foreign key
relationship or to see all tables, the Show Only Related Tables
can be set to NO.
On the Primary Key source page, which will be the primary key
for the Master table:
On the next Primary Key source page, which will be the primary
key for the Detail table:
On the Master Options page:
The master row
navigation option will add two buttons, Previous and Next, to the
Master part of the Master Detail page. These buttons are shown in
Figure 8.18. These buttons will scroll through the records in the
Master (DEPT) table one at a
The Master Row
Navigation Order will provide the sorting for the data in the Master
part of the Master Detail page. If no selection is made here, the
sorting will be determined by the primary key. Choosing a different
sorting order may impact the performance.
This option is
what indicates to the wizard you also want the report page. The
report page that will be built by the wizard is shown in Figure 8.17.
If a Report page has already been created, NO can be selected here to
prevent the wizard from creating another one.
On the Layout page, select the Edit detail as tabular form on
same page option and click Next.
To get the wizard to create two separate
pages, choose the Edit detail on separate page option. What this will
do is put a standard report in place of the tabular form in Figure
8.18. A separate form page will be built to allow edits on the Detail
One reason to create a separate page to edit
the detail records is because performing validation on the data in a
Tabular Form is difficult. Having a separate form to edit an
individual record makes data validation much easier.
On the Page Attributes page, enter the data as shown in Figure
8.16. This is where the names of the pages and regions the wizard is
going to create are setup. When the entries are completed, click
No tabs and click Next.
Finally, click Create and then, Run Page.
The pages produced from the wizard are shown in
Figures 8.17 and 8.18. From here the developer can go into the pages
and regions and do any customizations as they choose. Also, as
mentioned during the exercise, some developers may also have chosen to
provide their own report to replace the report created by the Master
Detail wizard. In this case, they will go to their custom report and
add the navigation links to navigate to the Master Detail page.
The above book excerpt is from:
Oracle Application Express
Dynamic Web Pages with OAE
Michael Cunningham & Kent Crotty