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)

How can I add a value to a column that has an enum type

(0) ShareShare
ReportReport
Posted on by 620

Hi everyone

I need to achieve the following:

Make a new BaseEnum with the following items (undefined, abc, def). Then make an EDT with this enum as basic type. So far so good.

Now I need to put this in a parameterstable. So I added a column with ExtendedDataType the EDT that I made here above and the enumtype automatically was the BaseEnum's.

Now I want to put one of the enum's value into this column, how can I achieve this ?

 

I tried already the following (for example):

parametersTable.ColumnEnum = BaseEnum::abc;
parametersTable.update();

 

Greetings,
Vincent

*This post is locked for comments

I have the same question (0)
  • David Massey Profile Picture
    on at

    Please indicate what your problem you are having.    

    There are examples of setting default value on most of the parameter tables.  (e.g. ProjParameters.initValue().)

    It is unclear as to whether you are providing the complete set of code in your example, but you need to:

        ttsgegin

        select table for updatate

        set the field values

        update the record

        ttscommit

  • Smartus Profile Picture
    620 on at

    My bad...

    If you don't mind I will post the code tomorrow since I am not at work for the moment and can't access it from home.

    I did it like you said it and first it didn't work but after a crash (suddenly happend) it was fixed partially. Now I don't get the error anymore as I tried to update the field with the enum. But it doesn't update as well. Because the value from the enum that I specified isn't in the table. If I debug I can see it gets updated, but when I browse to the table and open it, I see nothing that makes any sense...

    Tomorrow I will show some code examples.

    Thanks for the reply though

  • Smartus Profile Picture
    620 on at

    Here I am again this time with the screens:

    gyazo.com/0b86d607af802d4f3835fe851934280b

    As you can see I made an enum with 3 values. Afterwards I made an EDT with base type this enum. This one I used as the type for my column "MapsType". Shouldn't I normally get "Google, Bing and Undefined" in the dropdown ? I don't understand where this Element1 is coming from.

    What I actually want to do is choose one of the 3. And this is what I was trying to do with the update...

     

    Greetings

  • Smartus Profile Picture
    620 on at

    Seems that I had to define the label from the Enum ...

    I still have many things to learn of AX ... :-(

  • Verified answer
    jaestevan Profile Picture
    1,719 on at

    You have to write the name of the base enum in code. Based on your screenshot and your original code, it should work like this:

     

    parametersTable.ColumnEnum = McsMapsEnum::abc;  // wrong!! BaseEnum::

    parametersTable.update();

     

    Hope this helps.

    Regards.

  • Mohamed Hathout Profile Picture
    645 on at

    what is McsMapsEnum ?? please

  • Smartus Profile Picture
    620 on at

    As you can see in this screenshot: gyazo.com/0b86d607af802d4f3835fe851934280b it's just a regular base enum.
    Here I wanted to list all the maps that I was using for an implementation in AX. These values are shown inside a dropdown.

  • Mohamed Hathout Profile Picture
    645 on at

    thank you it was not working , coz i should have drag and drop the enum field when i did that .. its just working fine !!!

    thanks

  • Community Member Profile Picture
    on at

    you forgot to rename "Label" Property at BaseEnums... :)

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