Kbase P130043: 4GL/ABL: How to use the CAN-FIND() function?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  01/04/2008 |
|
Status: Unverified
GOAL:
4GL/ABL: How to use the CAN-FIND() function?
GOAL:
What does the CAN-FIND() function do?
FACT(s) (Environment):
All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x
FIX:
The CAN-FIND() function TRUE if it finds a record that meets the specified criteria and FALSE otherwise. It does NOT make the record available to the procedure.
The CAN-FIND() function may be used within a VALIDATE option of the UPDATE statement. For example:
CREATE customer.
UPDATE cust-num name sales-rep
VALIDATE(CAN-FIND(sales-rep WHERE
salesrep.sales-rep customer.sales-rep),
"Invalid sales rep -- please re-enter").
The CAN-FIND function may also be used in the WHERE clause of a FOR statement to restrict the returned result set. For example:
FOR EACH Customer NO-LOCK WHERE CAN-FIND( FIRST Order WHERE Order.custnum = Customer.Custnum):
DISPLAY CustNum NAME "Has Orders".
END.
The CAN-FIND function may also be used outside the the where clause of FOR statement to selectively process records. For example:
FOR EACH Customer NO-LOCK:
IF NOT CAN-FIND( FIRST Order WHERE Order.custnum = Customer.Custnum) THEN
DISPLAY CustNum NAME "This customer has no orders".
END.