Form example: orders.per

The orders.per form specification file contains a GRID and TABLE container arranged in a VBOX vertical box. The GRID holds form fields for the order header information, and the TABLE displayes the rows of the current order item list.

The orders.per form file:
  1 SCHEMA custdemo
  2 
  3 ACTION DEFAULTS
  4   ACTION find (TEXT="Find", IMAGE="find", COMMENT="Query database")
  5   ACTION new (TEXT="New", IMAGE="new", COMMENT="New order")
  6   ACTION save (TEXT="Save", IMAGE="disk", COMMENT="Check and save order info")
  7   ACTION append (TEXT="Line", IMAGE="new", COMMENT="New order line")
  8   ACTION delete (TEXT="Del", IMAGE="eraser", COMMENT="Delete current order line")
  9   ACTION first (TEXT="First", COMMENT="Move to first order in list")
 10   ACTION previous (TEXT="Prev", COMMENT="Move to previous order in list")
 11   ACTION next (TEXT="Next", COMMENT="Move to next order in list")
 12   ACTION last (TEXT="Last", COMMENT="Move to last order in list")
 13   ACTION quit (TEXT="Quit", COMMENT="Exit the program", IMAGE="quit")
 14   ACTION zoom1 (IMAGE="fa-list",ACCELERATOR=F8)
 15   ACTION zoom2 (IMAGE="fa-list",ACCELERATOR=F8)
 16 END
 17 
 18 TOPMENU
 19   GROUP ord (TEXT="Orders")
 20     COMMAND find
 21     COMMAND new
 22     COMMAND save
 23     SEPARATOR
 24     COMMAND quit
 25   END
 26   GROUP ord (TEXT="Items")
 27     COMMAND append
 28     COMMAND delete
 29   END
 30   GROUP navi (TEXT="Navigation")
 31     COMMAND first
 32     COMMAND previous
 33     COMMAND next
 34     COMMAND last
 35   END
 36   GROUP help (TEXT="Help")
 37     COMMAND about (TEXT="About")
 38   END
 39 END
 40 
 41 TOOLBAR
 42   ITEM find
 43   ITEM new
 44   ITEM save
 45   SEPARATOR
 46   ITEM append
 47   ITEM delete
 48   SEPARATOR
 49   ITEM first
 50   ITEM previous
 51   ITEM next
 52   ITEM last
 53   SEPARATOR
 54   ITEM quit
 55 END
 56 
 57 LAYOUT (TEXT="Orders",WINDOWSTYLE="main2")
 58 VBOX
 59 GRID
 60 {
 61 [l1     |f1   |f2                                             ]
 62 [l2     |f3   ] [l3         |f4          ] [l4     |f5        ]
 63 [l5     |f6   ]             [f7                               ]
 64                                    [l6         |f8            ]
 65 }
 66 END
 67 TABLE
 68 {
 69 [c1     |c2               |c3     |c4     |c5         |c6       ]
 70 [c1     |c2               |c3     |c4     |c5         |c6       ]
 71 [c1     |c2               |c3     |c4     |c5         |c6       ]
 72 [c1     |c2               |c3     |c4     |c5         |c6       ]
 73 }
 74 END
 75 END
 76 END
 77 
 78 TABLES
 79 customer, orders, items, stock
 80 END
 81 
 82 ATTRIBUTES
 83 LABEL l1 : label1, TEXT="Cust.:";
 84 LABEL l2 : label2, TEXT="Order #:";
 85 LABEL l3 : label3, TEXT="Order Date:";
 86 LABEL l4 : label4, TEXT="Ship By:";
 87 LABEL l5 : label5, TEXT="Factory:";
 88 LABEL l6 : label6, TEXT="Order Total:";
 89 EDIT f1 = orders.cust_num, NOENTRY;
 90 BUTTONEDIT f2 = customer.cust_name, NOTEDITABLE, ACTION=zoom1;
 91 EDIT f3 = orders.order_num, NOENTRY;
 92 DATEEDIT f4 = orders.order_date, NOT NULL;
 93 EDIT f5 = orders.fac_code, UPSHIFT;
 94 EDIT f6 = orders.ship_instr;
 95 CHECKBOX f7 = orders.promo, TEXT="Promotional", NOT NULL,
 96    VALUEUNCHECKED="N", VALUECHECKED="Y";
 97 EDIT f8 = FORMONLY.order_total TYPE DECIMAL(9,2), NOENTRY;
 98 BUTTONEDIT c1 = items.stock_num, TITLE="Stock#", NOT NULL, ACTION=zoom2;
 99 LABEL c2 = stock.description, TITLE="Description";
100 EDIT  c3 = items.quantity, NOT NULL, TITLE="Qty";
101 LABEL c4 = stock.unit, TITLE="Unit";
102 LABEL c5 = items.price, TITLE="Price";
103 LABEL c6 = FORMONLY.line_total, TITLE="Total";
104 END
105 
106 INSTRUCTIONS
107 SCREEN RECORD sa_items(
108    items.stock_num,
109    stock.description,
110    items.quantity,
111    stock.unit,
112    items.price,
113    FORMONLY.line_total
114   );
115 END
Note:
  • Line 1 defines the database schema to be used for this form specification file.
  • Lines 3 thru 16 define default attributes for actions with the ACTION DEFAULTS section.
  • Lines 18 thru 39 define a pull-down menu with the TOPMENU section, binding COMMAND action views by name to ON ACTION action handlers in the program code.
  • Lines 41 thru 55 define a toolbar with the TOOLBAR section, binding ITEM action views by name to ON ACTION action handlers in the program code.
  • Lines 57 thru 76 define the LAYOUT section of the form with a VBOX contaning a GRID container for the order header, and a TABLE container for the order item list.
  • Lines 78 thru 80 declare the use of the customer, orders, items and stock SQL table definitions of the custdemo schema.
  • Lines 82 thru 104 declare form field attributes for the table columns.
  • Lines 106 thry 115 define the form instructions.
  • Line 107 thru 114 declares the sa_items screen array, used to group form fields that define the TABLE columns for the order item list.