Map.elements Method [AX 2012]

Returns the number of elements in the map.

public int elements()

Run On

Called

Return Value

Type: int
The number of elements in the map.

The number of elements in the map is equal to the number of different key values in the map.

The following example uses the elements method to check whether a map has any elements. If the _from map exists, and has some elements, the values from the _from map are inserted into the _to map.

static void mergeRecsPrim( 
    Map _from, 
    Map _to 
    ) 
{ 
    MapEnumerator   me; 
  
    if (! _from) 
    { 
        return; 
    } 
 
    if (! _from.elements()) 
    { 
        return; 
    } 
 
    me = _from.getEnumerator(); 
    while (me.moveNext()) 
    { 
        _to.insert(me.currentKey(),me.currentValue()); 
    } 
} 

Community Additions

ADD
Show: