web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

The difference between Enum and Base Enum?

(0) ShareShare
ReportReport
Posted on by

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 :

mookups-enum.PNG

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

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hello Hanifa,

    EDT stands for extended data type its not enum. By using EDT we will create fields of primary data type, which we can re use.

    Base enum is for enumeration. for ex: if you want to assign january as 1, february as 2 etc.

  • Verified answer
    Community Member Profile Picture
    on at

    In your case you have to use enum.

    By your snapshots it seems you are trying to choose from multiple value n store it into field.

    To do this you have to create base enum with and add elements to it.

  • Community Member Profile Picture
    on at

    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.

  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at

    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.

  • Johnkrish Profile Picture
    781 on at

    Hi Brandon,

    nice explanation!!. could you please explain what is the use of creating EDT of type Enum?.

    thanks

    Johnkrish

  • Brandon Wiese Profile Picture
    17,788 on at

    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.

  • Community Member Profile Picture
    on at

    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???

  • Community Member Profile Picture
    on at

    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.

  • Verified answer
    Brandon Wiese Profile Picture
    17,788 on at

    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.

    PriceDiscAdmTrans-form-snippet.PNG

    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.

    PriceDiscAdmTrans-form-snippet.PNG

  • Community Member Profile Picture
    on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans