Share via


Map.create(Object[]) Method

Definition

Creates a map from the container that was obtained from a previous call to the Map.pack method.

public:
 static Microsoft::Dynamics::Ax::Xpp::Map ^ create(cli::array <System::Object ^> ^ _container);
public static Microsoft.Dynamics.Ax.Xpp.Map create (object[] _container);
static member create : obj[] -> Microsoft.Dynamics.Ax.Xpp.Map
Public Shared Function create (_container As Object()) As Map

Parameters

_container
Object[]

Returns

Map

A map that is equal to the map that was packed into the container by the Map.pack method.

Remarks

If the keys or values are objects, the objects must have an unpack method that is called to re-establish their internal state from the container.

The following example creates a map from a container that is passed into the method (conprojItemTransSalesAmount), adds some values to the container, and then packs the map and returns it as a new container.

server static container salesAmountDisplayCache( 
    container   _conprojItemTrans, 
    container   _conprojItemTransSalesAmount, 
    TransDate   _ledgerFromDate, 
    TransDate   _ledgerToDate) 
{ 
    ProjItemTrans    projItemTrans; 
    Set              setprojItemTrans; 
    Map              mapprojItemTransSalesAmount; 
    SetIterator      si; 
    if(_conprojItemTrans) 
    { 
        setprojItemTrans = Set::create(_conprojItemTrans); 
    } 
    if(_conprojItemTransSalesAmount) 
    { 
        mapprojItemTransSalesAmount = Map::create( 
            _conprojItemTransSalesAmount); 
    } 
    si = new SetIterator(setprojItemTrans); 
    si.begin(); 
    while (si.more()) 
    { 
        projItemTrans = ProjItemTrans::find(si.value()); 
        mapprojItemTransSalesAmount.insert( 
            si.value(),  
            projItemTrans.salesAmount( 
                projItemTrans, 
               _ledgerFromDate, 
               _ledgerToDate)); 
        si.next(); 
    } 
    return mapprojItemTransSalesAmount.pack(); 
}

Applies to