This is just a piece of code i want to remember so here it is. If you want to retrieve a list of data from somewhere and then display it, you can use this code. It also has example on how to use a container.
//this code can be on a table
static List getListOfWIPForCust(CustAccount _custAccount)
{
AxmWIPLookup wipTotals;
container cont;
List list = new List(Types::Container); //list will hold a container type
;
if (_custAccount)
{
while select wipTotals
where
wipTotals.CustAccount == _custAccount
&& wipTotals.WIPTotal
{
cont = conins(cont,1,wipTotals.ProjId); //load the data in the container, column 1
cont = conins(cont,2,wipTotals.WIPTotal); //column 2
list.addEnd(cont); //save it in the container
}
}
return list;
}
//this code can be anywhere you want to call up that list
boolean closeClientValidated()
{
AxmProjTableTotals wipTotals;
ProjId projId;
List wipList;
ListEnumerator wipListIterator;
container cont;
Amount wipAmount;
;
ret = true;
if (CustTable.openBalanceMST())
ret = false;
//check WIP total
wipList = AxmProjTableTotals::listOfProjWithWIP(CustTable.AccountNum); //load the list by calling the code above
wipListIterator = wipList.getEnumerator(); //use this to traverse through the list
if (!wipList.empty())
{
infolog.add(Exception::Info, "Projects with WIP for Customer " + CustTable.AccountNum);
while (wipListIterator.moveNext()) //traverse through the list
{
cont = wipListIterator.current(); //load the current list dataset into a container
projId = conpeek(cont,1); //grab the first column data
wipAmount = conpeek(cont,2); //grab the second column data
infolog.add(Exception::Info, "Project Code: " + projId + " WIP Total: " + num2str(wipAmount,10,2,1,2));
}
}
return ret;
}
No comments:
Post a Comment