Is this the most stupid thing in AL coding?

samantha73samantha73 Member Posts: 21
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?

Answers

  • Developer101Developer101 Member Posts: 405
    something we have to live with.:)
    United Kingdom
  • Developer101Developer101 Member Posts: 405
    I think this is only stupid thing in AL
    United Kingdom
  • samantha73samantha73 Member Posts: 21
    :) 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
Sign In or Register to comment.