KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Transactions and the "Execute on Server" Attribute
PRODUCT: 4D Client | VERSION: 18 | PLATFORM: Mac & Win
Published On: May 27, 2020

A transaction has an impact only on the current proccess. This means that when Method1 starts a transaciton in the client process and calls on Method2 with the "Execeute on Server" attribute to modify data, Method2 will be acting outside of the context of the transaction.





The behavior of this setup is that when a remote method starts a transaction, it only puts a flag on the remote side. Nothing is sent to the server. To optimize network traffic, the flag is sent to the server only when a database engine event actually occurs (i.e QUERY, LOAD RECORD, etc.). Executing a method on the server is not a database engine event, but a language event. Thus the server is not notified that a transaction must be started. A database event can be "forced" (ex. load record on an unused table) just after starting the transaction on the remote side to make sure the server gets the information.

However if you want to run the transaction on the server, it is recomended to start the transaction in the Execute on server method.