version 3
Locked {(table)} Boolean
Parameter | Type | Description | |
table | Table | Table to check for locked current record, or | |
Default table, if omitted | |||
Function result | Boolean | Record is locked (TRUE), or | |
Record is unlocked (FALSE) |
Description
Locked tests whether or not the current record of table is locked. Use this function to find out whether or not the record is locked; then take appropriate action, such as giving the user the choice of waiting for the record to be free or skipping the operation.
If Locked returns TRUE, then the record is locked by another user or process and cannot be saved. In this case, use LOAD RECORD to reload the record until Locked returns FALSE.
If Locked returns FALSE, then the record is unlocked, meaning that the record is locked for all other users. Only the local user or current process can modify and save the record. A table must be in read/write state in order for you to modify the record.
If you try to load a record that has been deleted, Locked continues to return TRUE. To avoid waiting for a record that does not exist anymore, use the LOCKED ATTRIBUTES command. If the record has been deleted, the LOCKED ATTRIBUTES command returns -1 in the process parameter.
During transaction processing, LOAD RECORD and Locked are often used to test record availability. If a record is locked, it is common to cancel the transaction.
See Also
LOAD RECORD, LOCKED ATTRIBUTES, Record Locking.