Establishes a target record in a collection. Format [ FIRST ] [ NEXT ] [ PRIOR ] SELECT [ ] [collection-name] [WITH boolean] [ LAST ] [ value-expression ] [ NONE ] [ ]
1 – Arguments
FIRST Selects the first record in the target collection. NEXT Selects the next record in the target collection. (See the second and third items in the Results section.) When you omit a position specification, NEXT is the default. PRIOR Selects the previous record in the target collection. (See the fifth and sixth items in the Results section.) LAST Selects the last record in the target collection. value-expression Evaluates to a positive number. DEC DATATRIEVE uses the integer part of the number to select the record with that position number in the collection. NONE Releases the selected record so that no selected record exists for the current collection. If the collection was formed from a file-structured database, SELECT NONE also releases the RMS lock on the selected record. collection-name Is the name of the target collection containing the record to be selected. If you omit the collection name, the target collection is the current collection. WITH boolean Causes DEC DATATRIEVE to select the record that satisfies both the Boolean expression and the collection position references (FIRST, LAST, NEXT, PRIOR, and value-expression).
2 – Examples
The following example selects the last record in the CURRENT collection: DTR> SELECT LAST DTR> The following example selects the fifth record in the collection BIG_ONES: DTR> SELECT 5 BIG_ONES DTR> The following example selects the last 30-foot boat in the YACHTS inventory from the CURRENT collection: DTR> FIND YACHTS [113 records found] DTR> SELECT LAST WITH LOA = 30 DTR> PRINT LENGTH OVER MANUFACTURER MODEL RIG ALL WEIGHT BEAM PRICE SOLNA CORP SCAMPI SLOOP 30 6,600 10 DTR> The following example selects a record from the CURRENT collection, modifies a field value, and releases the selected record and, in this case, the RMS lock on the record: DTR> READY YACHTS SHARED MODIFY DTR> FIND YACHTS WITH BUILDER = "SOLNA CORP" [1 record found] DTR> SELECT DTR> PRINT LENGTH OVER MANUFACTURER MODEL RIG ALL WEIGHT BEAM PRICE SOLNA CORP SCAMPI SLOOP 30 6,600 10 DTR> MODIFY PRICE Enter PRICE: 50000 DTR> PRINT LENGTH OVER MANUFACTURER MODEL RIG ALL WEIGHT BEAM PRICE SOLNA CORP SCAMPI SLOOP 30 6,600 10 $50,000 DTR> SELECT NONE DTR>