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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to get Enum Name of the Field which has type 4 in SQLDictionary Table

(1) ShareShare
ReportReport
Posted on by 2,477
Hi,
 
SQLDictionary table has a column FieldType. In this column the value 4 Represents Enum.
 
How Can I get the Enum Name behind the the fields which has the value 4? Is there any table which has the fieldname and Enum Name relationship?
 
Appreciate any tips
 
Thanks
  • Martin Dráb Profile Picture
    240,837 Most Valuable Professional on at
    Do you mean in X++ or in a development environment?
  • Suggested answer
    Layan Jwei Profile Picture
    8,301 Super User 2026 Season 2 on at
    Hi,
     
    If the enum is not extensible, you can simply open the enum in visual studio and look at the properties to see the number that represents each enum value.

    However, if the enum is extensible, you can look at EnumIdTable and EnumValueTable to get the Enum values
     
    Thanks,
    Layan Jweihan 
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • MYGz Profile Picture
    2,477 on at
    Hello Martin,

    I would prefer TSQL but X++ will also do. I'm just looking for a solution. My goal is to get all the entity names and it's fields along with datatypes and constraints in case of string and enum name (sorted in ascending enum value) in case of enums.
    I'm starting with 2 tables DMFEntity and SQLDictionary. Is there a better approach than to start with the above 2 tables?
     
    I'm stuck on 2 steps.
    First is as mentioned in this question.
    Second is to get all the DMFEntity names. Although DMFEntity provides all the entity names but when joining it with SQLDictionary table there are duplicates. I'm trying to remove the duplicates but still some of them are still there.

    @Layan I'm looking for bulk operation not just 1 table or few fields.

    Thank you for the replies
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,826 Super User 2026 Season 1 on at
    Hi @MYGz,
     
    all the enum name and item name are stored in SRSANALYSISENUMS Table.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • MYGz Profile Picture
    2,477 on at
    @Mohamed
     
    Thanks, but that's just Enum details. What I'm looking is the field name and enum name relation when the field type is Enum.
  • Layan Jwei Profile Picture
    8,301 Super User 2026 Season 2 on at
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,826 Super User 2026 Season 1 on at
    Hi @MYGz,
     
    In this case you must use x++ to identify the details.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • MYGz Profile Picture
    2,477 on at
     
    Though I am able to get the Entity Name and Fields from code in this blog:
     
    How do I get the:
    1. Field Type providing the entity view name and the field name to some Metadata function?
    2. Field Length if it's a string or edt.
    3. Enum values if it's an enum.
     
     
    Thanks.
  • Suggested answer
    Martin Dráb Profile Picture
    240,837 Most Valuable Professional on at
    You can use the metadata API to get information about table fields, e.g. the enum name.
     
    Element IDs of extensible enums are specific to each environment; you must look into EnumIdTable and EnumValueTable tables. SrsAnalysisEnums isn't sufficient in all cases, as far as I know.
     
    Regarding your last questions:
     
    1) First of all, learn how to iterate entity fields and look at their properties. Later we can optimize it, e.g. to avoid the iteration.
    2) String length is defined by the EDT (and its extensions).
    3) Answered above.
     
    It would help if you explained what you're trying to achieve, because some approaches may be more appropriate for your (unknown) goal than other or you might even utilize existing tools (such as AOT Browser).
  • MYGz Profile Picture
    2,477 on at
    Couldn't get past this. Which reflection method works on the DataEntity to get the field type and field length. Can it be achieved via TSQL? SQLDictionary is only missing the Enum Name and FieldName relation.

    The goal is to build the excel template for entities along with all the fields, its data type and length and values of Enums. Further Field description column would be written manually.
     
    public static void main(Args _args)
    {
    
        var entityNames = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::GetDataEntityViewNames();
        var enumerator = entityNames.GetEnumerator();
    
        while (enumerator.MoveNext())
        {
            var EntityName = enumerator.Current;
            Info(strFmt("The Entity Name is %1",EntityName));
    
            var DataEntity = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::GetDataEntityView(enumerator.Current);
            var dataEntityFields = DataEntity.Fields;
            var fieldsEnumerator = dataEntityFields.GetEnumerator();
    
            while (fieldsEnumerator.MoveNext())
            {
                var FieldName = fieldsEnumerator.Current.ToString();
                Info(strFmt("The First Field Name is %1 : Field Type is %2",FieldName, typeOf(fieldsEnumerator.Current)));
                break;
            }
            break;
        }
    
    }

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 515 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 417 Super User 2026 Season 2

#3
CU10121822-0 Profile Picture

CU10121822-0 360

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans