This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
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.
Note: The command works only with 4D and 4D Server. It returns an invalid object when called from 4D Remote. However, it can be called in this context if the "Execute on server" option is activated for the calling method. In this case, the object returned will contain information about the server. When called from a component, it always applies to the host database.
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_alias | String | User alias defined with SET USER ALIAS, otherwise user name in the 4D database directory |
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 |
(*) Only returned in binary databases. 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)
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 v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)