DictEnum.index2Name Method [AX 2012]

Returns the label of the enumeration item that is specified by an index.

public str index2Name(int index)

Run On

Called

Parameters

index
Type: int
The zero-based index of the enumeration in the AOT.

Return Value

Type: str
The label of the enumeration item that is specified by index; an empty string if index does not reference a valid enumeration item.

For backward compatibility with earlier versions of Microsoft Dynamics AX, "Name" in DictEnum::value2Name refers to the enumeration item's label property. To make your code more readable, use the DictEnum::value2Label method instead of the DictEnum::value2Name method. To retrieve the value of the name property of the enumeration item as shown in the AOT, use the DictEnum::value2Symbol method.

The following example shows the retrieval of the label for items in an enumeration.

DictEnum de; 
int      i; 
 
de = new DictEnum(enumName2Id("ActionType")); 
for (i=0; i < de.values(); i++) 
{ 
    print int2str(i) + ", " + de.index2Name(i); 
}

Community Additions

ADD
Show: