PRESELECT
[ EACH | FIRST | LAST ] record-phrase
[ , [ EACH | FIRST | LAST ] record-phrase ] ...
[ [ BREAK ]
{ BY expression [ DESCENDING ]
| COLLATE ( string , strength [ , collation ] ) [ DESCENDING ]
} ...
]
|
[ EACH
| FIRST
| LAST
] record-phrase
The record-phrase option identifies the criteria to use when preselecting records. Following is the syntax for the
record-phrase:
{ record [ field-list ] }
[ constant ]
[ [ LEFT ] OUTER-JOIN ]
[ OF table ]
[ WHERE expression ]
[ USE-INDEX index ]
[ USING [ FRAME frame ] field
[ AND [ FRAME frame ] field ] ...
]
[ SHARE-LOCK | EXCLUSIVE-LOCK | NO-LOCK ]
[ NO-PREFETCH ]
|
Specifying multiple occurrences of record-phrase preselects the tables using an inner join. Also, any sorting you specify applies to all the tables. If you then do a FIND on the last table in the PRESELECT list, the AVM reads records into the buffers for all of the tables in the list.
BY expression [ DESCENDING
]
Sorts the preselected records by the value of expression. If you do not use the BY option, PRESELECT sorts the records in order by the index used to extract the records. The DESCENDING option sorts the records in descending order (not in the default ascending order).
COLLATE (
string ,
strength [ ,
collation ] )
[ DESCENDING
]
|
RAW — Generates a collation value for the string based on its binary value.
|
|
CASE-SENSITIVE — Generates a case-sensitive collation value for the string based on a particular collation. If you specify this strength with an ICU collation, the AVM applies the ICU TERTIARY strength.
|
|
CASE-INSENSITIVE — Generates a case-insensitive collation value for the string based on a particular collation. If you specify this strength with an ICU collation, the AVM applies the ICU SECONDARY strength.
|
|
CAPS — Generates a collation value for the string based on its binary value after converting any lowercase letters in the string to uppercase letters, based on the settings of the Internal Code Page ( -cpinternal) and Case Table ( -cpcase) startup parameters.
|
|
PRIMARY — Generates a collation value for the base characters in the string.
|
|
SECONDARY — Generates a collation value for the base characters and any diacritical marks in the string.
|
|
TERTIARY — Generates a case-sensitive collation value for the base characters and any diacritical marks in the string.
|
|
QUATERNARY — Generates a case-sensitive collation value for the base characters and any diacritical marks in the string, and distinguishes words with and without punctuation. ICU uses this strength to distinguish between Hiragana and Katakana when applied with the ICU-JA (Japanese) collation. Otherwise, it is the same as TERTIARY.
|
|
strength does not evaluate to a valid value.
|
|
collation does not evaluate to a collation table residing in the convmap.cp file.
|
|
collation evaluates to a collation table that is not defined for the code page corresponding to the -cpinternal startup parameter.
|
REPEAT PRESELECT EACH Order, Customer OF Order, EACH OrderLine OF Order
BY Order.OrderDate BY Order.CustNum BY OrderLine.ItemNum:
FIND NEXT OrderLine.
DISPLAY Order.OrderDate Order.CustNum Customer.Name OrderLine.ItemNum.
END.
|
In this example, the AVM finds and displays order number 4 even though the selection criteria specifies that the order number must be greater than 5. The ROWID always overrides other selection criteria. Furthermore, if you use FIND...WHERE ROWID(
record) =..., the index cursor is not reset in the preselected list. That is, even if record ROWID(
record) is in the preselected list, FIND NEXT does
not find the record that follows it in the preselected list.