Doing a unique FIND to retrieve a single record
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Very often you just need to retrieve a single record
using selection criteria that identify it uniquely. In this case,
you can use a FIND statement with no directional
qualifier. For example, you can identify a Customer by
its Customer number. This is a unique value,
so you can use the following FIND statement:
|
The following figure shows the result.

You need to be sure when you do this that only one record satisfies the selection criteria. Otherwise, you get an error at run time.
This is a shorthand for this FIND statement:
|
You can use this shorthand form if the primary index is a unique
index (with no duplication of values), the primary index contains
just a single field, and you want to retrieve a record using just
that field. You can use this form only when all these conditions
are TRUE, so it's not likely to be one you use
frequently. Also, this shorthand form makes it harder to determine your
criteria. It can break if the data definitions change (for example,
if someone adds another field to the CustNum index),
so it's better to be more specific and use a WHERE clause
to identify the record.