4D v16.3

Locked

Home

 
4D v16.3
Locked

Locked 


 

Locked {( aTable )} -> Function result 
Parameter Type   Description
aTable  Table in Table to check for locked current record, or Default table, if omitted
Function result  Boolean in Record is locked (TRUE), or Record is unlocked (FALSE)

Locked tests whether or not the current record of aTable 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 cannot be saved because it is locked by another user or another process, or it is stacked in the current process. 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 BY command. If the record has been deleted, the LOCKED BY command returns -1 in the process parameter.

Note: Locked returns False when there is no current record in table, in other words, when Record number returns -1.

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 

Get locked records info
LOAD RECORD
LOCKED BY
Record Locking

 
PROPERTIES 

Product: 4D
Theme: Record Locking
Number: 147

This command can be run in preemptive processes

 
HISTORY 

Created: < 4D v6

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)