Map::create Method [AX 2012]
Creates a map from the container that was obtained from a prior call to the Map.pack method.
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();
}
Show: