CURRENT-CHANGED function
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
record
ExampleThe following example finds the first customer record with NO-LOCK and makes it available to the user to review and change:
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 cannot check the current values against the initial values of BLOB or CLOB fields. If you use CURRENT-CHANGED on a ProBindingSource’s data source that contains a BLOB or a CLOB field, it raises an error unless you set the ProBindingSource’s NoLOBs property to TRUE.
See also
OpenEdge Release 10.2B
|