Table Fields
The following example illustrates the use of the loadtable statement to load a table field with information retrieved from the employee database:
## forms
## forminit empform
## range of d is department
## range of e is employee
/* get the department name and retrieve information */
## prompt ("enter department name: ", vdept)
## retrieve (vfloor = d.floor) where d.dept = vdept
/* display the form and initialize fields */
## display empform
## initialize (department = vdept, floor = vfloor)
## {
## inittable empform employee update (sal = f4, eno = i4)
## retrieve (vname = e.empname, vage = e.age,
## vsal = e.salary, vnum = e.empnum)
## where e.dept = vdept
## {
## loadtable empform employee
## (ename = vname, age = vage,
## sal = vsal, eno = vnum)
## }
## }
## activate menuitem "end"
## {
## breakdisplay
## }
## finalize
## /* update database table — see example below */
## endforms
This example prompts the user for a department name, fills the simple fields of the form with information on that department and then loads the table field with rows for the employees in the department. In this example, the loadtable statement is included as part of the initialization of the form's display loop. When the form appears, the table field already contains rows of values. Because the table field is in update mode, users can browse and update the rows in the table field.
Last modified date: 08/28/2024