Tech Tip: Get Locked Records Info on Client/Server
PRODUCT: 4D Client | VERSION: 17 | PLATFORM: Mac & Win
Published On: October 2, 2019
Get locked records info returns an object with details regarding locked records and related users/processes. However, calling this command in 4D Remote will return a null object. Here is an example below:
The Get locked records command is only compatible with 4D and 4D Server. When callled from 4D Remote, a null object is returned. To retrieve information regarding locked records in Client/Server mode, you will want to either call the Get locked records info command with the "On server execute" option or use the LOCKED BY command instead.
LOCKED BY command:
- Documentation for the LOCKED BY command: https://doc.4d.com/4Dv17/4D/17.3/LOCKED-BY.301-4621056.en.html
Get locked records info command:
- Here are the steps to allow the Get locked records info command to return a non-null object on Client/Server mode:
- Call on the Get locked records info command in a new method
C_OBJECT($0)
$0:=Get locked records info([Table_Name]) - Click on the information icon in the method editor (Opens the method properties)
- Check the box option for "On server execute" (This sends the procedure to the server)
- Create another new method and insert the code below. (This second method retrieves the information back from the server and allows the debugger to be opened on the client side)
ALL RECORDS([Table_Name])
TRACE
$locked:=Locked Records in Table Method - Running the second method should open up the debugger. Display the variable retuned by the Get locked records info command ($locked) in the expression pane to view details regarding locked records. The object should no longer be null, as shown in the image below.