Previous Next

ENTERED function
Checks whether a frame field has been modified during the last INSERT, PROMPT-FOR, SET, or UPDATE statement for that field, and returns a TRUE or FALSE result.
Note:
Syntax 
 
[ FRAME frame ] field ENTERED
[ FRAME frame ] field
The name of the frame field you are checking. If you omit the FRAME option, the field name must be unambiguous.
Example 
This procedure goes through the Customer table and prompts the user for a new CreditLimit value. The ENTERED function tests the value the user enters. If the user enters a new value, the procedure displays the old and new CreditLimit values. If the user enters the same or no value, the value does not change.
 
DEFINE VARIABLE new-max NO-UNDO LIKE Customer.CreditLimit.
 
FOR EACH Customer:
  DISPLAY Customer.CustNum Customer.Name Customer.CreditLimit 
    LABEL "Current credit limit"
    WITH FRAME a 1 DOWN ROW 1.
  SET new-max LABEL "New credit limit"
    WITH SIDE-LABELS NO-BOX ROW 10 FRAME b.
  IF new-max ENTERED THEN DO:
    IF new-max <> Customer.CreditLimit THEN DO:
      DISPLAY "Changing Credit Limit of" Customer.Name SKIP
        "from" Customer.CreditLimit "to" new-max 
        WITH FRAME c ROW 15 NO-LABELS.
      Customer.CreditLimit = new-max.
      NEXT.
    END.
  END.
  DISPLAY "No Change In Credit Limit" WITH FRAME d ROW 15.
END.
Notes 
*
*
*
 
/* This code does not compile. */
 
DEFINE FRAME x
  myint AS INTEGER
  mychar AS CHARACTER.
 
ON LEAVE OF mychar
  IF mychar ENTERED THEN 
    MESSAGE "Character value changed.".
 
UPDATE myint mychar WITH FRAME x.
The DEFINE FRAME statement does not scope the frame. Therefore, the reference to the ENTERED function in the trigger cannot be evaluated. To fix the problem, reference the frame in a DISPLAY statement before the ON statement.
See also 
NOT ENTERED function

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.