RE: Sum in AX Dynamics 2012 R3
How to set output setValue data to ABS_SumAmountMST field menu item. Given my code:
public real calculateSumAmountTransactCurrency()
{
CustTrans custrans;
real sumValue;
MultiSelectionHelper helper = MultiSelectionHelper::construct();
ABS_SumAmountMST.realValue(0);
//super();
//sumAmountMST.realValue(0);
helper.parmDatasource(CustTrans_DS);
custrans = helper.getFirst();
while (custrans.RecId != 0)
{
//info(custrans.AmountMST.toString());
info(custrans.RetailStoreId);
custrans = helper.getNext();
// ABS_SumAmountMST=sum(ABS_SumAmountMST, custrans.AmountMST);
sumValue+=custrans.AmountMST;
}
// return ABS_SumAmountMST;
return sumValue;
}