Monday, November 26, 2012

DictEnum class in AX2012


The DictEnum class obtains meta-information about the base enumeration enumerations in the AOT.
This can be used when you want to access an enum properties or values at run time.
Can be initialized as below:
DictEnum            dictEnum;
dictEnum = new DictEnum(enumNum(DMFEntityType));

Now we are ready to all properties of enum DMFEntityType

dictEnum.value2Label(i)- Retrieves the label of a specified enumeration value. ‘i’ being the enumeration value

dictEnum.index2Label(i) - can be used in a for loop where ‘i’ being the iterator index value.  This will retrieve the label of the enumerator at specified index.
dictEnum.index2value(i) - can be used in a for loop where ‘i’ being the iterator index value.  This will retrieve the enumerator value of the enumerator at specified index.

No comments:

Post a Comment