I have 2 forms which are based on the same table. Both of them delete everything in that table on open.
I want to not allow a form to run (and delete records in the table) if another form is already opened it and filled with records.
On onOpen trigger of the forms I'm using Locktable:
TempTable.LOCKTABLE;
TempTable.DELETEALL;
But it doesn't work, they still is opening and deleting records.
How it should be?
(NAV 4.0 sp3)
0
Comments
Table locking is not an front-end but and back-end/database issue and is handled according to which database (server) is used. Lookup LOCKTABLE in the NAV online help - then move forward to topics like concurrency, optimistic/pesimistic table locking, instances...found in other documents/books.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
real why is just this - I have one available table and 2 forms which make calculations and fill this table and then display those records.
last option is to use single instance cu to set a variable indicating that a form is open. but I think its not the best solution.
This is not true. Form could be based on temp table since first versions if I am correct... But you need to use correctly the OnFindRecord and OnNextRecord triggers for that and one global variable... ;-)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
can u please give me an example how to use OnFindRecord and OnNextRecord triggers for that purpose?
dik
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
You cannot "reserve" a table for an instance of a form! You cannot control that in the application layer. It makes no sense and violates the very basic rules of NAV development! Such "solutions" lead to the dead end of NAV programming and then it's again that "NAV crap". My advice to you is: DON'T EVEN THINK ABOUT IMPLEMENTING IT! [-X