MapEnumerator.currentKey Method [AX 2012]

Returns the key from the (key, value) pair that is currently pointed to by the enumerator.

public anytype currentKey()

Run On

Called

Return Value

Type: anytype
The key from the map element that is currently pointed to by the enumerator.

You must call the MapEnumerator.moveNext method before you call the currentKey method.

The following example searches for a particular table ID in a map and then returns the key value of that map element.

private LabelType tableLabel(tableId _tableId) 
{ 
    LabelType     labelType; 
    MapEnumerator mapEnum; 
 
    mapEnum = tableAllMap.getEnumerator(); 
 
    while (mapEnum.moveNext()) 
    { 
        if (_tableId == mapEnum.currentValue()) 
        { 
            labelType = mapEnum.currentKey(); 
            break; 
        } 
    } 
    return labelType; 
}

Community Additions

ADD
Show: