Share via


Map::create Method

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

Syntax

client server public static Map create(container container)

Run On

Called

Parameters

Return Value

Type: Map Class
A map equal to the one 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.

Examples

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(); 
}

See Also

Map Class

Map.pack Method