4D v15Get locked records info |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v15
Get locked records info
|
Get locked records info ( aTable ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
aTable | Table |
![]() |
Table for which you want to know the locked record(s) | |||||
Function result | Object |
![]() |
Description of locked records (if any) | |||||
Originally introduced in 4D v14 R3
Theme: Record Locking
The new Get locked records info command returns an object containing information about the currently locked record(s) in aTable.
The returned object contains a "records" property which is an array of objects:
{
"records": [
description object,
(…)
]
}
Each "description object" array element identifies a locked record in the specified table and has the following properties:
Property | Type | Description |
contextID | UUID (String) | UUID of the database context responsible for the lock |
contextAttributes | Object | Object containing the same information as the LOCKED BY command but applied to the record; the difference being that Get locked records info returns the user name defined in the system and not that of the 4D user (see below). |
recordNumber | Longint | Record number of the locked record |
Note: For more clarity, the LOCKED ATTRIBUTES command has been renamed LOCKED BY starting with 4D v14 R3.
The contextAttributes object is made up of the following properties:
Note: You can get the 4D user name from the value of user4d_id by using the following code:
GET USER LIST($arrNames;$arrIDs)
$4DUserName:=Find in array($arrIDs;user4d_id)
Note: The command works only with 4D and 4D Server. It always return an invalid object when called from remote 4D or a component. However, it can be called in these contexts if the "Execute on server" option is enabled. In this case, the object returned will contain, respectively, information about the server or the host database.
You execute the following code:
$vOlocked :=Get locked records info([Table])
If two records were locked in the [Table] table, the following object is returned in $vOlocked:
{
"records": [
{
"contextID": "A9BB84C0E57349E089FA44E04C0F2F25",
"contextAttributes": {
"task_id": 8,
"user_name": "roland",
"user4d_id": 1,
"host_name": "iMac de roland",
"task_name": "P_RandomLock",
"client_version": -1342106592
},
"recordNumber": 1
},
{
"contextID": "8916338D1B8A4D86B857D92F593CCAC3",
"contextAttributes": {
"task_id": 9,
"user_name": "roland",
"user4d_id": 1,
"host_name": "iMac de roland",
"task_name": "P_RandomLock",
"client_version": -1342106592
},
"recordNumber": 2
}
]
}
{
"records": [
{
"contextID": "B0EC087DC2FA704496C0EA15DC011D1C",
"contextAttributes": {
"task_id": 2,
"user_name": "achim",
"user4d_id": 1,
"host_name": "achim-pcwin",
"task_name": "P_RandomLock",
"is_remote_context": true,
"client_uid": "0696E66F6CD731468E6XXX581A87554A",
"client_version": -268364752
},
"recordNumber": 1
}
]
}
Product: 4D
Theme: Language
4D v15 - Upgrade (standard edition) ( 4D v15)