locktable parameter ?

Hello I have a question on the locktable parameter. In wich cases will navision stop (and will not wait untill the lock is released)a second user to modify/insert a record, where the table is locked by a different user ? Where follwing code is used ? TableA.Locktable As far as i understand the locktable parameter, it will wait untill the lock is released or ?? Or do i have to use TableA.Locktable(True). I mean using locktable or locktable(true) is the same or ? Wich means navison will wait untill the lock is released or ?

LOCKTABLE without parameter equals LOCKTABLE(TRUE). If you use the function, and the table is locked from another session (user), and TRUE is parameter, your session will wait till the other session unlock the table. If parameter is FALSE you will get an error message. Informing that table allready is locked… If you do not use LOCKTABLE, your session will lock a table when you start to write or modify. Anyway - read the help-text in Navision [;)] …

@Anfinnur So far so clear. Why i am asking this is. When i don’t find a locktabel(false)in the whole navision code. how can it happen, that a user receives the message, that he/she could not lock the tableX cause a nother user has already locked the tableX and he/she has to start the process again ? When a locktable is not explecit used and write action wil made on the table, is the locktable parameter then false or true ? If it is false then it would be the reason for the error message. would be great to know, cause i can not locate the problem

The implicit locks are typically caused by poor architecture, for example:


User A ----------------- User B
=========================================
TableA.MODIFY ---------- 
CONFIRM (something) ----
------------------------ TableA.GET(

User B will get that locking problem, until the process at the user A will end, or a COMMIT is issued. there may be other cases, including nested loops, basically anything where a uncommitted transaction is left hanging for a long time. Hope that helps

Your problems is simply a deadlock situation. On Navision Server, a deadlock will produce the message: “The xx table cannot be locked or changed because it is already locked by the user with User ID yy. Wait until the user is finished and then try again.” So you just need to identify the code that locks the tables in the incorrect order. Use the tools in the “Performance Troubleshooting Toolkit” from the Tools CD to help you find the deadlocking code. - Jens

quote:


Originally posted by Jens Rainer
Your problems is simply a deadlock situation. So you just need to identify the code that locks the tables in the incorrect order. Use the tools in the “Performance Troubleshooting Toolkit” from the Tools CD to help you find the deadlocking code.


@Jens Well that was what wanted to ask :wink: But can you tell me, what do you mean(or better what is) correct oder for table locks ?? I will take a look on that tool, when we have that cd (is a special licenz needed?)

Forgot to say. It is allways a lock Problem with table 221 Where user A is creating booking lines, and user B is booking a contract into a invoice. Where User B receives the lock message.

You are home free: Get the CD from your NTR, remember to ask them to update your license (there is a special - free - granule you need for the tool). Run the appropriate tool (it is based on the Client Monitor) on the two scenarios you have already identified. That will give you the conflicting lock sequences. Change one of them, and you’re done. You can also do this without the tool, using the CLient Monitor alone, but the tools are cool and very useful, so you’ll want them anyway. Unfortunately there are no exhaustive list of recommended lock sequences covering all tables. The C/AL Guide has a very limited one, but basically you need to agree on one for your tables. - jens