Doubt codeunit.run

gonzy1981
Member Posts: 156
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???
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
-
No, I don't catch you.
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.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
-
For codeunit, there is not something like RUNMODAL. Only RUN exists and it behaves as RUNMODAL.
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.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Alex Chow wrote: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.Mark Brummel wrote:It might be related to buffered inserts.kriki wrote:Only RUN exists and it behaves as RUNMODAL
Is this on SQL Server? What are the SQL statements generated?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions