Returns TRUE if the copy of the record in the buffer after executing a FIND CURRENT or GET CURRENT differs from the copy of the record in the buffer before executing the FIND CURRENT or GET CURRENT. That is, if the current application changes the record, but no other user changes the record during its scope in the current application, CURRENT-CHANGED returns FALSE.
Syntax
CURRENT-CHANGED record
record
The name of a table or buffer.
Example
The following example finds the first customer record with NO-LOCK and makes it available to the user to review and change:
r-currch.p
FORM Customer.Name Bustomer.Balance WITH FRAME upd.
ON GO OF FRAME upd DO:
DO TRANSACTION:
FIND CURRENT Customer EXCLUSIVE-LOCK.
IF CURRENT-CHANGED Customer THEN DO:
MESSAGE "This record has been changed by another user" SKIP
"Please re-enter your changes." VIEW-AS ALERT-BOX.
DISPLAY Customer.Name Customer.Balance WITH FRAME upd.
RETURN NO-APPLY.
END.
ASSIGN Customer.Name Customer.Balance.
END.
FIND CURRENT Customer NO-LOCK.
END.
FIND FIRST Customer NO-LOCK.
DISPLAY Customer.Name Customer.Balance WITH FRAME upd.
DO ON ENDKEY UNDO, LEAVE:
ENABLE Customer.Name Customer.Balance WITH FRAME upd.
WAIT-FOR "GO" OF FRAME upd.
END.
While the user reviews the record, other users can change it. After the user makes a change of their own and enters GO in the frame, the first FIND CURRENT statement refetches the current customer record with an EXCLUSIVE-LOCK (preventing other users from reading or updating it). Then, the CURRENT-CHANGED function compares the contents of the customer record with the copy of the customer record that was in the buffer before the FIND CURRENT statement. If it differs, the CURRENT-CHANGED function returns a TRUE value, prints a message, and displays the contents of the customer record contained in the buffer. The RETURN NO-APPLY option prevents the program from ending and gives the user another chance to change the customer record.
The CURRENT-CHANGED function returns a FALSE value if the copy of the customer record that is in the buffer was not modified. After verifying that the copy of the record has not changed, the ASSIGN statement updates the customer record and a second FIND CURRENT statement down grades the record to NO-LOCK. Thus, while the user has ample time to review and change the record, the actual transaction time is kept to a minimum to allow other users access.
Notes
The CURRENT-CHANGED function is valid only when called after a FIND CURRENT or GET CURRENT statement.
If a client application modifies the buffer, the AVM compares the newly read record with the buffer contents from that application, rather than with the record read from the server. The CURRENT-CHANGED function continues to return a value based on the contents of the buffer until the next FIND CURRENT or GET CURRENT operates on that buffer or until the buffer goes out of scope or is released.
The CURRENT-CHANGED function can compare the current values with the initial values of BLOB or CLOB fields provided the table is in an OpenEdge database.