Equinox Online Help - Language Reference - A to Z
Subtable ... End Subtable |
|
---|---|
Applies to | |
Syntax | Subtable TableName [, Unlinked]
[statements]End Subtable Note that you can use EndSubtable instead of End Subtable. |
Action | [Statement] This statement defines a statement block, within which the developer may temporarily access a new home table. If the specified table is locked by another user, then the system workarea SysError is set to a non-zero value. |
Scope | Usable anywhere. |
Notes | You use this statement to create a subtable block. A subtable block is a powerful structure, within which you can access a new home table and directly control the Equinox database manager. Inside a subtable block, all database control passes to the developer, who is responsible for choosing an index and finding records. The block name, TableName, sets the home table for the block. When the End Subtable statement is reached, Equinox reverts to the original home table again. The Continue Subtable statement causes control to pass to the first line after the Subtable statement. The Exit Subtable statement causes control to pass to the line following End Subtable. Note that you may nest subtable blocks, if required. When a subtable block is started, it will attempt to link the home table inside the block with the home table outside the block, in the same way that the SameRecord statement does. To suppress this, include the Unlinked clause in the declaration. |
Category | Flow Control |
See Also | Block_EndBlock, BreakPressed, Continue, Execute, EnableInput, Exit, For...Next, Goto, If_Then, Repeat_EndRepeat, Repeat_Until, Return, Sleep, Switch, While_EndWhile |
Example | The following example calculates the total number of orders for the current customer. When used with child tables, the special index name DefaultIndex selects a child index (which can find records only for the current parent). subtable ordersend subtable | ordersSetIndex DefaultIndexNextRecord The next method sets up three separate indexes for customers with unpaid invoices more than 1, 2, or 3 months old. The method examines each customer's invoices in reverse date order. If it finds an unpaid invoice, then the customer's record is added to the appropriate index. The subtable blocks are used to step through the customer and invoice records. Note that the system workarea SysError is set to True when no more invoice records can be found for the current customer. The method uses two fields: InvoicePaid (a logical value) and InvoiceDate. One index is used, InvoiceDate, which is a child table index. logical marked1,marked2,marked3 |