Is this the most stupid thing in AL coding?
            
                
                    samantha73                
                
                    Member Posts: 119                
            
                        
            
                    Well, I've been pulling my hair out trying to figure out how to pass a parameter to a code unit and the way NAV/BC does this is not intuitive at all. here's an example from Github
https://github.com/microsoft/AL/issues/3845
Quote
"Teaching AL development to an experienced outside developer is an many aspects interesting. Just take this topic.
So he starts programming a codeunit object in AL like this:
codeunit 66666 MyCodeunit
{
trigger OnRun()
begin
end;
}
And now he would like to add a parameter to the OnRun trigger. What is the most intuitive way to do that? What would be most logic for any non-NAV developer to do that?
Right, like adding a parameter to any function. Place your cursor in between the bracket and start typing:
codeunit 66666 MyCodeunit
{
trigger OnRun(var Rec : Record "My Table")
begin
end;
}
Indeed, VSCode will error telling that this is a wrong signature. All NAV developers know you have to define the TableNo property (well, I even dare to argue that):
codeunit 66666 MyCodeunit
{
TableNo = "My Table";
trigger OnRun( )
begin
end;
}"
seriously how hard can it be?
                https://github.com/microsoft/AL/issues/3845
Quote
"Teaching AL development to an experienced outside developer is an many aspects interesting. Just take this topic.
So he starts programming a codeunit object in AL like this:
codeunit 66666 MyCodeunit
{
trigger OnRun()
begin
end;
}
And now he would like to add a parameter to the OnRun trigger. What is the most intuitive way to do that? What would be most logic for any non-NAV developer to do that?
Right, like adding a parameter to any function. Place your cursor in between the bracket and start typing:
codeunit 66666 MyCodeunit
{
trigger OnRun(var Rec : Record "My Table")
begin
end;
}
Indeed, VSCode will error telling that this is a wrong signature. All NAV developers know you have to define the TableNo property (well, I even dare to argue that):
codeunit 66666 MyCodeunit
{
TableNo = "My Table";
trigger OnRun( )
begin
end;
}"
seriously how hard can it be?
0                
            Answers
- 
            something we have to live with.:)United Kingdom0
 - 
            I think this is only stupid thing in ALUnited Kingdom0
 - 
            
 glad if this is the only one..hope so.  I think AL has its own quirks you get used to ..perhaps you only notice this when you are starting out                        0 - 
            Agree but could be a reason behind which only Microsoft Knows
                        Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 - 
            I believe they're just keeping with convention, to make the transition from C/AL to AL easier. In C/AL, you define the table no. for the codeunit in similar fashion.2
 
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
 - 323 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
 

