Current Codeunit as Variable/Parameter

SonGoten13
Member Posts: 44
Hi,
Does someone know if it is possible to put the current running instance of a codeunit into a variable to use it then as a parameter?
The same that Rec does for a Table Object?
Would need it for a workaround.
Does someone know if it is possible to put the current running instance of a codeunit into a variable to use it then as a parameter?
The same that Rec does for a Table Object?
Would need it for a workaround.
0
Comments
-
I think would be possible to achieve that, passing the codeunit parament by reference (Var = true).* Daniele Rebussi * | * Rebu NAV Diary *0
-
Yes, you can pass a codeunit as parameter and when selecting by variable all internal globals will be mainained.
However, it is not a really elegant solution and other developers will wonder why you did that.
It is done in standard NAV with Assembly Management. Here the reason was to avoid creating multiple registers.
IMHO there are more elegant solutions for that.0 -
thx for your responses, but i think you misunderstood me.
I know that you can pass a codeunit as parameter and i agree that its not that elegant. I could do it differnt but i would have to change quite some code what i would like to avoid.
Anyway my question is:
Is it possible to put the current running instance of a codeunit into a variable, from code within that codeunit? I dont have Rec like i have when i am in a table, but i would like to achieve the same thing.
I am in cuX. From there i want to call a function in cuY with parameter cuX(the current running instance, i dont have a variable to use). Then i make cuY.RUN which calls a function in cuX(has to be the same intance, from where i started).
Hope i made myself clear this time. Anybody a clue if this is possible?0 -
Hi,
if you mark codeunit as SingleInstance=true, NAV will protect this codeunit in memory including all global variables defined in it.0 -
Yeah, that would be also an option, but i dont want to do that.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