Hi:
I have a couple of processing-only reports. One of them creates Purchase Orders (both Purchase Header records and Purchase line records) by reading a table of imported records. The volume is high (500+ purchase orders created at a time), so the report runs for awhile.
While the report is running, other users cannot post because the "Purchase Line table is in use."
The report is simple. It reads another table and creates Purchase Header/Line records based on the contents of the record just read, then repeats.
Am I correct that if I insert a COMMIT statement at the end of the OnAfterGetRecord trigger (where the INSERT's to the Purchase Header and Line table occur), that NAV will "release" the table lock after each insert? Or, as I have read in other threads, must I move the INSERT code to a separate codeunit which is called each time?
Similarly, I have a report that goes through Vendor Ledger Entry records and fixes 1099-related data. While the report is running, users cannot post.
Thanks
Ron
Ron
0
Comments
Just remember that COMMIT must enclose a complete-logical transaction.
So for example: Create the Header, Create the lines, Create dimensions etc... then modify your table to note that the data were processed and then COMMIT.
Exactly the answer I was looking for. For me - easy. It's the last statement in the trigger now. Thanks for the reply.
Ron
RIS Plus, LLC
Good suggestion! My primary issue was with letting users post - they were getting "table locked by another user..." My idea is if I COMMIT after each transaction, it gives other users time to get their own lock. Seems like COMMIT'ing every 50, then SLEEPING for a few seconds (to allow other users to get in) sounds like the best combination of techniques.
Thanks to all!
Ron
Oh and that is assuming that your server is configured properly, and your database files are separated the right way. You might already know all about this, I don't know how well you know this kind of thing
RIS Plus, LLC