1

I have a client server application (desktop app having 4 users and installed on different machines) on 4D. I have written an SOAP web service whose primary role is to read data from another database of SQL Server and insert those one into 4D. All is working fine if no-one using the application. Now issue was that if someone using the application then my SOAP service is unable to write the data into 4D. Another issue was in my mind that if there is any locking feature is applied on 4D then this should be applicable for all the 4 user who are communicating with centralized 4D.

Can anyone please help me what was the exact issue? Is it in 4D or something needed to incorporate in my SOAP service.

Noctis Skytower
  • 21,433
  • 16
  • 79
  • 117
Ajay
  • 21
  • 2

1 Answers1

2

Generally you should use UNLOAD RECORD after you modified a record.

But a record can be locked for a lot of time for example if a customer open a dialog to modify it, for example, and keep it open. You should avoid to modify directly the records that are often used and modified by users, but if you need to do it the more general way is to wait until the record is writeable:

READ WRITE([Table]) //Change state to writeable
Repeat
   DELAY PROCESS(Current Process; 30) //just wait 30 ticks (= half second)
   LOAD RECORD([Table]) //Try to load record
Until(Not(Locked([Table])))
   // --> here you can make changes to record 
SAVE RECORD([Table]) 
UNLOAD RECORD([Table]) //this free the record lock
READ ONLY([Table]) //  Change state to read-only
Umberto Migliore
  • 317
  • 4
  • 17