Hello,
I've done two codeunits which do these things:
codeunit 50000
CD50001.RUN;
table50000.i := 333333;
Table50000.localtime := TIME;
Table50000.INSERT;
Here is the code of the codeunit 50001:
FOR i := 0 TO 2000 DO BEGIN
TABLE50000.I := i;
TABLA50000.localtime := TIME;
TABLA50000.INSERT;
END;
Then I realize after running this that the record 333333 is the oldest (according to the TIME), If I'm running the cd50001 in run (not runmodal). Why firstly is running all the code of the cd50001 and the system is waiting?? And after have finished whole the cd50001 carry on with the following code of the codeunit 50000.
Codeunit 50000 is like, It would have been run in runmodal.
Do you catch me???
0
Comments
To resolve a problem like this, run your code using the debugger and step through. You'll be able to figure out the answer you need.
Once you find the answer, remember to come back here and post your findings.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
If you do something like this with forms/pages or reports, you will have the same result because a NAV-session can only run 1 set of statements at the time, so when you launch a RUN, this one starts and does everything it has to do and when it finishes (but does not close if you use RUN) the calling object can continue to do its things.
So what you saw is perfectly normal both for codeunits and other objects.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I can't see how this would happen in this particular case. Nothing is read back from the db and timestamps are set by code, not by the database. Furthermore, nothing gets modified or overwritten. Just plain inserts.
That's right. If so, and given (assumed) buffering does not alter anything in this case, the outcome is truly astonishing.
Is this on SQL Server? What are the SQL statements generated?