Try OpenEdge Now
skip to main content
ABL Reference
Handle Attributes and Methods Reference : FIND-UNIQUE( ) method
 

FIND-UNIQUE( ) method

Gets a single record. This method lets a user get a unique record that satisfies the predicate expression.
Return type: LOGICAL
Applies to: Buffer object handle

Syntax

FIND-UNIQUE ( predicate-expression[ , lockmode[ , waitmode]] )
predicate-expression
A character expression that evaluates to the following syntax:
[ WHERE [ logical-expression ]][ USE-INDEX index-name]
Once evaluated, predicate-expression can contain only constants and unabbreviated references to fields from the buffer. The predicate-expression itself can be built using a concatenation of character expressions.
lockmode
An integer expression evaluating to one of the following constants: SHARE-LOCK, EXCLUSIVE-LOCK, or NO-LOCK. You can assign NO-LOCK to an integer variable. For example, mylock = NO-LOCK.
The default is SHARE-LOCK.
waitmode
An integer expression evaluating to one of the following: NO-WAIT, 0, or the Unknown value (?). The default is to wait.
You can assign NO-WAIT to an integer variable. For example, mywait = NO-WAIT.
The following shows some examples of the FIND-UNIQUE method:
DEFINE VARIABLE bh     AS HANDLE    NO-UNDO.
DEFINE VARIABLE myname AS CHARACTER NO-UNDO.

bh = BUFFER Customer:HANDLE.

bh:FIND-UNIQUE("WHERE Customer.Custnum < 3 AND
Customer.Name = 'lift line skiing'").

bh:FIND-UNIQUE("WHERE Customer.CustNum = 30").

bh:FIND-UNIQUE("WHERE Customer.Name = " + QUOTER(myname).
MESSAGE bh:AMBIGUOUS.
If FIND-UNIQUE succeeds, it returns TRUE, otherwise it returns FALSE.
If FIND-UNIQUE fails, a message displays. You can suppress this message using NO-ERROR on the statement containing the method.
If more than one record satisfies the predicate expression, then the AMBIGUOUS attribute is set to TRUE.

See also

FIND-FIRST( ) method, FIND-CURRENT( ) method, FIND-LAST( ) method, FIND statement