How to loop through enum in dynamics ax 2012 using x++
Method 1:
SysDictEnum sysDictEnum = new SysDictEnum(enumnum(InventTransType));
InventTransType currentElement;
currentElement= sysDictEnum.firstValue();
do
{
info(strFmt("%1",currentElement));
currentElement= sysDictEnum.nextValue(currentElement);
} while (currentElement != sysDictEnum.firstValue());
Method 2:
SysDictEnum sysDictEnum = new SysDictEnum(enumnum(InventTransType));
InventTransType currentElement;
int iLoop;
for (iLoop=0 ; iLoop < SysDictEnum.values(); iLoop++)
{
info(SysDictEnum.index2Label(iLoop));
}
Comments
Post a Comment