Halo Experts,
It's my first experience using Enum (EDT)/ Base Enum. What is the difference between them? I have this design, let's analyze them of what should i use best :
For :
Field 1 : Should i use base enum?
Field 2 : Should i use enum (EDT)?
Note: both values are string(50) not integer, i need fixed values (for both fields) & application users are not able to define the values for both fields.
Thank you.
*This post is locked for comments
hi,
I am a beginner in Ax so when i was reading about enums i came across in many places that an enum can have upto 251 literals but you have said 255. i tried looking it up but can you explain?
thank you :)
Glad I could help.
If you marked one of the replies as the Answer, it might help others in the future also.
Brandon,
Wow, i forgot to use type hierarchy browser, i see that three of them has same value (Table, group, all), i thought at first that they has different values. Okay it's super clear to me now. I get it now, the reason why EDT- enum is needed, because we need to override Base Enum values but with different property. Thanks for illustrating it.
Perhaps some visual illustrations will cement these concepts.
Here is the Type hierarchy browser from Base enum TableGroupAll, showing not just how ItemCode extends TableGroupAll, and how PriceDiscitemCode extends ItemCode, but just how many other EDT's are extended from each other in this tree. When I say that TableGroupAll is a common Base enum in AX, I'm not kidding!
In the right pane each of the properties is listed in rows, showing how each EDT inherits from the one it extends, as shown from right to left. Note that TableGroupAll has a Label of @SYS17743, but ItemCode overrides that Label with @SYS58740, and further how TableGroupAll does not have a HelpText at all, but PriceDiscItemCode has a HelpText of @SYS20804.
Here is the PriceDiscAdmTrans form, more commonly know as the Price/discount journal lines. Here we can see the ItemCode field, which has a type of PriceDiscItemCode. The values of Table, Group, and All, inherit from the Base enum TableGroupAll, while the Label of "Item code" inherits from the EDT of ItemCode, and the HelpText at the bottom from EDT PriceDiscItemCode. That is the essence of inheritance.
Hi Ahmed,
I've tried Base enum, it's working. But there's strange behavior.
1. Both fields (by default) showing first value, when i picked (for both fields) first value it's not saved in my table.
2. There's a possibility that this two fields are mandatory, so what ever showed in default that must be saved too.
I want to know exactly just what John Krish asked. Okay Brandon. So,
(BASE ENUM) Table GroupAll > (EDT-ENUM) ItemCode > (EDT-ENUM) PriceDiscItemCode.
I've checked : (ENUM) Table GroupAll : contains : Table, GroupId, All.
So, please correct me if i'm wrong :
(Not related to my case, but in universal situation) Base Enum is what created first, then when sometime we need to extend to it, we can extend using EDT-ENUM right? But, i want to ask you one thing.. Is there any relation : I see (ENUM) Table GroupAll : contains : Table, GroupId, All. But ItemCode contains item code and PriceDiscItemCode contains discount. So, what is inherited by (ENUM) Table GroupAll in this case? I mean why itemcode and PriceDiscItemCode inherite TableGroupAll???
Sure.
A good example is the EDT PriceDiscItemCode, which extends EDT ItemCode, which extends Base enum TableGroupAll, which is a common Base enum in AX for rule based tables.
In this case, ItemCode inherits the values of TableGroupAll, which it cannot change, but it does change the Label to a more specific "Item code". Then PriceDiscItemCode, which is used in trade agreement tables like PriceDiscTable and PriceDiscAdmTrans, inherits from ItemCode, but changes the HelpText to "Item code (item number, item discount group, all). That HelpText, which mentions item discount group, would not be proper for all cases of ItemCode, hence the more specific PriceDiscItemCode which can mention discounts because it is a trade agreement specific EDT, even though its values ultimately inherit from TableGroupAll.
Hope this helps.
Hi Brandon,
nice explanation!!. could you please explain what is the use of creating EDT of type Enum?.
thanks
Johnkrish
Base enums are a fixed set of values, integers in the database, which have a name (as referenced from X++ code) and a label (visible to users and translatable into different languages). They cannot be added to in real time by the application, only by developers and often with significant overhead, hence how they are fixed. You can have up to 255 values for Base enums. The integers in the database will take on the values 0 through 254.
Extended data types can be integers, strings, real numbers, and so on. They extend other data types, from which they inherit the original properties and change a few as needed. Examples of what a EDT might change are the label, precision, alignment, display properties, etc. Since an EDT can extend a Base enum, an EDT can behave exactly like a particular Base enum as needed, with cosmetic changes (not changes to the values themselves). EDT's can even extend each other.
EDT's can be related to the primary key in a table of data, and in that way the values for an EDT, whether integer or string, can be flexible by adding more records to the related table. They can also be completely free fields that accept any value. They are flexible in that way.
Because your values are fixed, you should strongly consider a Base enum. That means your data should be integer. Your labels can be as long as you want, with 50 characters being perfectly reasonable.
Hi Ahmed,
Yes, you're right i'm trying to choose from multiple value n store it into field in my table. Okay i'll try that, thanks. I'll update soon if it's working.
André Arnaud de Cal...
291,979
Super User 2025 Season 1
Martin Dráb
230,848
Most Valuable Professional
nmaenpaa
101,156