PRESELECT phrase
Specifies a set of records to preselect for a DO or REPEAT block.
Syntax
[ EACH | FIRST | LAST ]record-phrase
Goes through a table, selecting records that meet the criteria you specify inrecord-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.Therecord-phrase
option identifies the criteria to use when preselecting records. Following is the syntax for therecord-phrase
:
Specifying multiple occurrences ofrecord-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.For more information onrecord-phrase
and inner joins, see the Record phrase reference entry.BREAKBYexpression
[ DESCENDING ]COLLATE (string
,strength
[ ,collation
] ) [ DESCENDING ]string
strength
A CHARACTER expression that evaluates to an ABL comparison strength or an International Components for Unicode (ICU) comparison strength.The ABL comparison strengths include:
- 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.The ICU comparison strengths include:
- 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.
Note: Use ICU comparison strengths only with ICU collations.collation
ExamplesTo process a multi-table collection gathered by the PRESELECT option, use the last table named in the collection when you want to read the selected records. The AVM then automatically retrieves records from the other tables.
The PRESELECT option in this example selects the logically joined record that consists of Order, OrderLine, and Customer, and makes all of these records available in the REPEAT block. Usually you perform more complex processing within the PRESELECT block.
If, within a PRESELECT block, you find a record using the ROWID of that record, the AVM disregards any other selection criteria you applied to the PRESELECT. For example, suppose the ROWID of Order number 4 is stored in the variable
ord-rowid
:
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.See alsoDEFINE BUFFER statement, DO statement, FIND statement, REPEAT statement
OpenEdge Release 10.2B
|