Commands and Statements

Command SELECT Foundation

Selects and activates a work area.

SELECT <nWorkArea> | <cAlias>
<nWorkArea> is a positive integer specifying the number of the work area selected or activated. The argument can be specified as a literal or as a numeric expression in parentheses.
<cAlias> can be specified as an alternative for <nWorkArea>. It is either a literal name or a character expression in parentheses containing the alias name for the work area to be selected or activated.

The file command SELECT selects a work area and sets it as the active work area. All functions called without the alias operator execute their operations in the active work area. Either the numeric value (ordinal number) of a work area or its alias name is specified in the command. When the value 0 is specified, the command selects the work area with the lowest ordinal number where no files are opened (the next free work area).

The functional equivalent of the command SELECT is the function DbSelectArea().

// The example illustrates various ways to call SELECT, 
// as well as the effect of the alias operator. 

   LOCAL nWorkArea 

   USE Customer 
   ? Select()                   // result: 1 
   ? Alias()                    // result: CUSTOMER 

   SELECT (2) 
   USE Invoice ALIAS Inv 
   ? Select()                   // result: 2 
   ? Alias()                    // result: INV 

   USE Part ALIAS Part NEW 
   ? Select()                   // result: 3 
   ? Alias()                    // result: PART 

   ? Customer->(RecNo())        // result: 1 
   ? Customer->(Select())       // result: 1 
   ? Inv->(Select())            // result: 2 
   ? nWorkArea := Select()      // result: 3 

   SELECT Customer 
   ? Alias()                    // result: CUSTOMER 
   ? Select()                   // result: 1 

   ? (nWorkArea)->(Alias())     // result: PART 
   ? (nWorkArea)->(RecNo())     // result: 2 

   SELECT (nWorkArea) 
   ? Alias()                // result: PART 

   SELECT (0) 
   ? Alias()                // result:   (null string("")) 
   ? Select()               // result: 4 



If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.