PRESELECTEACH FIRST LAST record-phrase, EACH FIRST LAST record-phraseBREAKBY expression DESCENDINGCOLLATE ( string , strength , collation ) DESCENDINGrecord-phraseEACH FIRST LASTGoes through a table, selecting records that meet the criteria you specify in record-phrase. PRESELECT creates a temporary index that contains pointers to each of the preselected records in the database table. Then you can use other statements, such as FIND NEXT, within the block to process those records.The record-phrase option identifies the criteria to use when preselecting records. Following is the syntax for the record-phrase:
record field-listconstantLEFT OUTER-JOINtableOFexpressionWHEREindexUSE-INDEXframe fieldUSING FRAMEAND FRAME frame field
SHARE-LOCK EXCLUSIVE-LOCK NO-LOCKNO-PREFETCHSpecifying 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 DESCENDINGSorts 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).
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.A CHARACTER expression that evaluates to the name of an ABL collation table or ICU collation. If collation does not appear, COLLATE uses the collation table of the client.
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 OrderBY Order.OrderDate BY Order.CustNum BY OrderLine.ItemNum:
FIND NEXT OrderLine.DISPLAY Order.OrderDate Order.CustNum Customer.Name OrderLine.ItemNum.END.
DO PRESELECT EACH Order NO-LOCK WHERE Order.OrderNum > 5:FIND FIRST Order NO-LOCK WHERE ROWID(Order) = ord-rowid.DISPLAY Order.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.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |