Options

How to lock table on record level?

mtlmonkmtlmonk Member Posts: 48
Hi,

How can I tackle the following situation:

On periodic event, there is an automatic process that will read an xml file and make changes to a sales order / lines through web service.

On the other hand, we've got users making changes to the orders.

We've had issues where the automatic process would not update the record because between the moment the order is read and modified, a user has made a change to the order.

How can we lock the record once the automatic process reads a sales header/line until it's finished being modified?

LOCKTABLE after it's read? When does NAV release the "lock"?

Answers

  • Options
    krikikriki Member, Moderator Posts: 9,090
    The command is:
    TheTable.LOCKTABLE;

    It does not lock the table (it did in the classic DB...), but in only starts reading with EXCLUSIVE LOCK the records after the command. They will be released when your transaction is COMMITTED to the DB (or an error is raised).

    But I wonder: how much time does it take between reading the line and updating it?
    There shouldn't be that much difference. If there is, maybe you should also review the automatic process to make it shorter between reading and updating.

    Keeping data locked too long is not a good idea for any ERP. Yes, it makes sure no one will change your data between reading and updating, but concurrence is at risk.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.