4D v16.3Get locked records info |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
Get locked records info
|
Get locked records info ( aTable ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
aTable | Table |
![]() |
Table where you want to get locked records | |||||
Function result | Object |
![]() |
Description of locked records (if any) | |||||
The Get locked records info command returns an object containing different 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 information similar to 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, as well as additional information (see below). |
recordNumber | Longint | Record number of the locked record |
The contextAttributes object is made up of the following properties:
Property | Type | Description |
task_id | Number | Process reference number |
user_name | String | User name defined by operating system |
user4d_id | Number | 4D user number(*) |
host_name | String | Name of host machine |
task_name | String | Process name |
client_version | Number | Version of client application |
Only when command is executed on 4D Server and if record locking comes from a remote 4D: | ||
is_remote_context | Boolean | Indicates whether a remote 4D is the origin of the locking(always true since otherwise it is not present) |
client_uid | UUID (String) | UUID of 4D remote at the origin of the locking |
(*) You can get the 4D user name from the value of user4d_id by using the following code:
GET USER LIST($arrNames;$arrIDs)
$User4DName:=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 4D Remote or a component. However, it can be called in these contexts if the "Execute on server" option is activated. 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: Record Locking
Number:
1316
Created: 4D v14 R3
4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)