Tutorial Chapter 11: Master/Detail
The form used by the program in this chapter contains fields from
both the orders
and items
tables in the custdemo
database, illustrating a master-detail relationship. Since there are multiple items associated with
a single order, the rows from the items
table are displayed in a table on the form.
This chapter focuses on the master/detail form and the unique features of the corresponding
program.
The Master-Detail sample The example discussed in this chapter is designed for the input of order information (headers and order lines), illustrating a typical master-detail relationship. The form used by the example contains fields from both the orders
and items
tables in the custdemo
database.The Makefile The BDL modules and forms used by the application in this chapter can be compiled and linked in Genero Studio using the Application-level Execute or Build options. If you prefer command line tools you can compile and link using a Makefile . This file is interpreted by the make utility, which is a well-known tool to build large programs based on multiple sources and forms.The Customer List Module The custlist.4gl module defines a 'zoom' module, to let the user select a customer from a list. The module could be reused for any application that requires the user to select a customer from a list.The Stock List Module The stocklist.4gl module defines a 'zoom' module, to let the user select a stock item from a list. This module uses the stocklist.per form and is typical list handling using the DISPLAY ARRAY statement, as discussed in Chapter 07.The Master-Detail Form Specification File The form specification file orderform.per defines a form for the orders
program, and displays fields containing the values of a single order from the orders
table. The name of the store is retrieved from the customer
table, using the column store_num
, and displayed. A screen array displays the associated rows from the items
table.The Orders Program orders.4gl Much of the functionality is identical to that in earlier Tutorial examples. The query/add/delete/update of the orders
table would be the same as the examples in Chapter 4 and Chapter 6. Only append and query are included in this program, for simplicity. The add/delete/update of the items
table is similar to that in Chapter 8. The complete orders
program is outlined, with examples of any new functionality.