Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : Database Access : Fetching records : Sample record fetches
Sample record fetches
The examples that follow show some of the many ways you can access records. These examples are not meant to be exhaustive, but merely to show some of the flexibility provided by ABL, as shown.
*Specifies the FIRST, LAST, NEXT, or PREV options to step through all records in a particular sequence:
FIND FIRST Customer.
*Specifies boolean expressions to describe the record or records to be fetched:
FOR EACH Customer
  WHERE Customer.CreditLimit > 5000 AND Customer.Balance < 12000:
*Specifies a constant value of the primary index for the record. This works only if the primary index is single-component. Also, this technique is not supported for the OPEN QUERY statement:
FIND Item 12.
*Specifies one or more field values that are currently in the screen buffer or record buffer:
PROMPT-FOR Customer.CustNum WITH FRAME abc.
FIND Customer USING FRAME abc Customer.CustNum.
DISPLAY Customer.Name.
*Specifies a previously found related record from another table (the two tables must share a field with the same name, and that field must have a UNIQUE index in at least one of the tables):
FIND FIRST Customer.
FOR EACH Order OF Customer: /* This uses the custnum field */
*Specifies a CONTAINS clause on a word-indexed field:
FOR EACH Customer WHERE Customer.Comments CONTAINS "ship":
You cannot use a CONTAINS clause with the FIND statement. You can use CONTAINS only with the OPEN QUERY and FOR EACH statements.