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.

Although order_num is also one of the fields in the items table, it does not have to be included in the screen array or in the screen record , since the order number will be the same for all the items displayed for a given order. For each item displayed in the screen array, the values in the description and unit columns from the stock table are also displayed.

The values in FORMONLY fields are not retrieved from a database; they are calculated by the BDL program based on the entries in other fields. In this form FORMONLY fields are used to display the calculations made by the BDL program for item line totals and the order total.

This form uses some of the attributes that can be assigned to fields in a form. See Form item attributes in the Genero Business Development Language User Guide for a complete list of the available attributes.

Form orderform.per:
01 SCHEMA custdemo 
02 
03 TOOLBAR
04  ITEM new (TEXT="Order", IMAGE="new", COMMENT="New order")
05  ITEM find (TEXT="Find", IMAGE="find")
06  SEPARATOR
07  ITEM append (TEXT="Line", IMAGE="new", COMMENT="New order line")
08  ITEM delete (TEXT="Del", IMAGE="eraser")
09  SEPARATOR
10  ITEM previous (TEXT="Prev")
11  ITEM next (TEXT="Next")
12  SEPARATOR
13  ITEM getitems (TEXT="Items", IMAGE="prop")
14  SEPARATOR
15  ITEM quit (TEXT="Quit", COMMENT="Exit the program", IMAGE="quit")
16 END
17 
18 LAYOUT 
19 VBOX
20 GROUP
21 GRID
22 {
23   Store #:[f01  ] [f02                                          ]
24   Order #:[f03  ]  Order Date:[f04         ] Ship By:[f06       ]
25   Factory:[f05  ]             [f07                              ]
26                                      Order Total:[f14           ]
27 }
28 END
29 END -- GROUP
30 TABLE
31 {
32  Stock#  Description       Qty     Unit    Price       Total 
33 [f08    |f09              |f10    |f11    |f12        |f13      ]
34 [f08    |f09              |f10    |f11    |f12        |f13      ]
35 [f08    |f09              |f10    |f11    |f12        |f13      ]
36 [f08    |f09              |f10    |f11    |f12        |f13      ]
37 }
38 END
39 END
40 END
41 
42 TABLES
43   customer, orders, items, stock 
44 END
45 
46 ATTRIBUTES
47  BUTTONEDIT f01 = orders.store_num, REQUIRED, ACTION=zoom1;
48  EDIT       f02 = customer.store_name, NOENTRY;
49  EDIT       f03 = orders.order_num, NOENTRY;
50  DATEEDIT   f04 = orders.order_date;
51  EDIT       f05 = orders.fac_code, UPSHIFT;
52  EDIT       f06 = orders.ship_instr;
53  CHECKBOX   f07 = orders.promo, TEXT="Promotional",
54                  VALUEUNCHECKED="N", VALUECHECKED="Y";
55  BUTTONEDIT f08 = items.stock_num, REQUIRED, ACTION=zoom2;
56  LABEL      f09 = stock.description;
57  EDIT       f10 = items.quantity, REQUIRED;
58  LABEL      f11 = stock.unit;
59  LABEL      f12 = items.price;
60  LABEL      f13 = formonly.line_total TYPE DECIMAL(9,2);
61  EDIT       f14 = formonly.order_total TYPE DECIMAL(9,2), NOENTRY;
62 END
63 
64 INSTRUCTIONS
65 SCREEN RECORD sa_items(
66   items.stock_num,
67   stock.description,
68   items.quantity,
69   stock.unit,
70   items.price,
71   line_total 
72 )
73 END
Note:
  • Lines 03 thru 16 define a TOOLBAR section with typical actions.
  • Lines 23 and 48 The field f02 is a LABEL , allowing no editing. It displays the customer name associated with the orders store number
  • Lines 19 and 49 Field f03 is the order number from the orders table.
  • Lines 25 and 53 The field f07 is a CHECKBOX displaying the values of the column promo in the orders table. The box will appear checked if the value in the column is "Y", and unchecked if the value is "N".
  • Lines 26 and 61 The field f14 is a FORMONLY field This field displays the order total calculated by the BDL program logic.
  • Lines 30 thru 38 describe the TABLE container for the screen array.
  • Lines 33, 56 and 58 The fields f09 and f11 are LABELS, and display the description and unit of measure for the items stock number.
  • Lines 33 and 60 the field f13 is a LABEL and FORMONLY. This field displays the line total calculated for each line in the screen array.
  • Lines 42 thru 44 The TABLES statement includes all the database tables that are listed for fields in the ATTRIBUTES section of the form.
  • Line 47 The attribute REQUIRED forces the user to enter data in the field during an INPUT statement.
  • Line 51 The attribute UPSHIFT makes the runtime system convert lowercase letters to uppercase letters, both on the screen display and in the program variable that stores the contents of this field.
  • Line 65 The screen record includes the names of all the fields shown in the screen array.