PreviousNextIndex

CAN-FIND function

Returns a TRUE value if a record is found that meets the specified FIND criteria; otherwise it returns FALSE. CAN-FIND does not make the record available to the procedure. You typically use the CAN-FIND function within a VALIDATE option in a data handling statement, such as the UPDATE statement.

You can use CAN-FIND to see if a record exists with less system overhead than that of a FIND statement. The query capabilities are similar. CAN-FIND is also useful for implementing inner joins among database tables.

Syntax

CAN-FIND  
  ( 
    [ FIRST | LAST ] record [ constant ] 
    [ OF table ] [ WHERE expression ] [ USE-INDEX index ] 
    [ USING [ FRAME frame ] field 
       [ AND [ FRAME frame ] field ] ... 
    ] 
    [ SHARE-LOCK | NO-LOCK ] [ NO-WAIT ] [ NO-PREFETCH ] 
  ) 

You can specify the OF, WHERE, USE-INDEX, and USING options in any order.

FIRST
LAST
record
constant
OF table
WHERE expression
USE-INDEX index
USING [ FRAME frame ] field [ AND [ FRAME frame ] field ]
SHARE-LOCK
NO-LOCK
NO-WAIT
NO-PREFETCH
Example

In the following procedure, the UPDATE statement uses the VALIDATE option to make sure that the salesrep entered matches one of the salesreps in the database. The VALIDATE option uses the CAN-FIND function to find the record.

r-canfnd.p
REPEAT: 
  CREATE Customer. 
  UPDATE Customer.CustNum Customer.Name Customer.SalesRep 
    VALIDATE(CAN-FIND(SalesRep.SalesRep  
      WHERE SalesRep.SalesRep = Customer.SalesRep), 
      "Invalid sales rep -- please re-enter"). 
END. 

Notes
See also

FIND statement


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex