Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

ENUMs lookup.

Posted on by Microsoft Employee

Hello,

1. I would like to add a lookup that shows a list of all the enum types.

2. I would like to add a enum, but show not only the enum values (i.e if the enum has 'A', 'B', 'C' values, want for to show 'A', 'B', without the 'C' when doing lookup on that enum).

Thanks :)

*This post is locked for comments

  • AyediHoussine Profile Picture
    AyediHoussine 5 on at
    RE: ENUMs lookup.

    You can use the method

    ControlName_LineType.delete((enum2Str(ABCEnumType::C)));

    where ControlName_LineType is the Formcomboboxcontrol name where we find the Enum variable.

    learn.microsoft.com/.../dynamics.ax.application.formcomboboxcontrol

    learn.microsoft.com/.../dynamics.ax.application.formcomboboxcontrol.delete

  • Verified answer
    Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: ENUMs lookup.

    Eitan Mizrahi,

    Can you please explain little more ?

    Additionally, you may have a look at following standard examples from AX AOT

    1. SRSReportDeploymentSettings (Table)
    2. SRSReportDeploymentSettings (Form)
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: ENUMs lookup.

    Sohaib - Thank you.

    Is there any similar solution for extended datatype (only string based).

    Thanks :)

  • Suggested answer
  • Suggested answer
    RE: ENUMs lookup.

    Hi Eitan,

    you will definitely use the Sysdictclass object, but you'll fill the temporary table in order to give the lookup field a datasource.

    Or

    You can double check how the form DMFTargetXMLToEntityMap and look for the stringEdit: TargetXMLToEntityMapGroup_EntityField (method lookup). It's using a lookup method on UtilElements.

    Hope this helps.

    BR,

    Luca Pellegrini

  • Verified answer
    Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: ENUMs lookup.

    For your question number 1 here is the solution:

    public void lookup()

    {

    Query sysModelElementQuery;

    QueryBuildDataSource sysModelElementDataSource;

    QueryBuildRange sysModelElementRange;

    // create lookup table for SysModelElements and use the Name field

    SysTableLookup lookupTable = SysTableLookup::newParameters(tableNum(SysModelElement), this);

    lookupTable.addLookupfield(fieldNum(SysModelElement, Name));

    lookupTable.setLabel("Base Enum Name");

     

    // create a query used to filtering only the Base enumerations.

    sysModelElementQuery = new Query();

    sysModelElementDataSource = sysModelElementQuery.addDataSource(tableNum(SysModelElement));

    sysModelElementRange = sysModelElementDataSource.addRange(fieldNum(SysModelElement, ElementType));

    sysModelElementRange.status(RangeStatus::Hidden);

    sysModelElementRange.value(SysQuery::value(enum2int(UtilElementType::Enum)));

    lookupTable.parmQuery(sysModelElementQuery);

    lookupTable.performFormLookup();

    super();

    }

     

     

     

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: ENUMs lookup.

    You didn't understand me well - sorry.

    1. All the list of enums is like you standing on menuitem object, and see the list of all enum, when standing on enumtypeParameter property.

    2. I don't want using temporary table - just using a sysdictclass or something similar.

    Thanks :)

  • Verified answer
    RE: ENUMs lookup.

    Hi Eitan,

    have you tried to create a temp table and fill it with your enum values (filtering them if needed) on the lookup method of your form control?

    Hope this helps.

    BR,

    Luca Pellegrini

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,902 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,302 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans