| Tutorial Chapter 11: Master/Detail | |
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.
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