Enums & Interfaces #208
waldo1001
started this conversation in
BC Best Practices
Replies: 2 comments
-
Another question, if you have an enum as a field in a table. Should you have a interface "accessor" function to return the interface? This would stop having to have an interface variable and then assign the enum to the interface variable. so this table 50000 SomeTable {
fields{
field(1; PK; Code[10]) {}
field(2; EnumField; Enum SomeEnum) {}
}
procedure EnumFieldInterace(): Interface SomeInterface //what should the procedure name be?
begin
exit(EnumField);
end;
}
codeunit 50000 SomeCodeunit {
procedure DoSomething()
var
SomeTable: Record SomeTable;
begin
SomeTable.Get();
SomeTable.EnumFieldInterface().InterfaceMethod();
end;
} rather than table 50000 SomeTable {
fields{
field(1; PK; Code[10]) {}
field(2; EnumField; Enum SomeEnum) {}
}
}
codeunit 50000 SomeCodeunit {
procedure DoSomething()
var
SomeTable: record SomeTable;
SomeInterface: interface SomeInterface;
begin
SomeTable.Get();
SomeInterface := SomeTable.EnumField
SomeInterface.InterfaceMethod();
end;
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
I saw some really interesting stuff from a couple of wise guys today at TechDays that should be worked into this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I try to put "the use of interfaces" into a guideline. Here's one suggestion:
Here's a thread and poll on Twitter: https://twitter.com/waldo1001/status/1600160428205953025?s=20&t=sEYmkMuf31LOvxakj2zy1Q
Beta Was this translation helpful? Give feedback.
All reactions