Sunday, April 26, 2015

Enum Fuctions in ax 2012

                 Enum Fuctions in ax 2012
1.enum2Str Function:
Converts the specified enumerated text to a character representation.
Syntax:
str enum2Str(enum enum)
Example:
The following example returns the string " EUTrade." It is the label for the ListCode enumeration type.
    ListCode l;
    ;
    l =  ListCode::EUTrade;
    info(enum2Str(l));
we can also use(enum2Value) this below code to retrieve value of enum elements.
ListCode ls;
    ;
    ls=  ListCode::EUTrade;
    info(enum2Value(ls));
Op: EUTrade

2.enumCnt Function:

Retrieves the number of elements in the specified enumeration type.

Syntax: int enumCnt(enum enumtype)

Example:
print enumCnt(NoYesUnchanged);// Op: 3
or
print enumCnt(ListCode);// Op:9
pause;

KEEP DAXING !!!

No comments:

Post a Comment

Export a copy of the standard user acceptance testing (UAT) database

 Reference link: Export a copy of the standard user acceptance testing (UAT) database - Finance & Operations | Dynamics 365 | Microsoft ...