RE: How to add List to a container
Hi Martin,
here is the part of code:
List localParmTableFieldList = localParmTableRecord.parmTableFieldList();
List localList = new List(Types::Class);
localList.addEnd(localParmTableRecord.parmTableFieldList());
ListIterator localParmTableFieldListIterator = new ListIterator(localParmTableFieldList);
container c;
c = conIns(c, conCounter, _localTableData.parmTableName());
while (localParmTableFieldListIterator.more())
{
conCounter ;
Dynamics.AX.Application.XXXParmTableField localParmTableField = localParmTableFieldListIterator.value(); //I use Dynamics.AX.Application here because there is a .NET class with same name and compiler needs to know which to reference
c = conIns(c, conCounter, localList.pack()); //Error is thrown here after running the code, not during the compilation
localParmTableFieldListIterator.next();
}
So, I assign List returned from a contract class to the Local List variable and use the "pack" of it. Then I built the code without errors, but the error is thrown during the execution.
Here is the parm method from the contract class I use:
The error message is "XXXParmTableField object does not have method 'Pack'"
[
DataMemberAttribute("XXXParmTableField"),
DataCollection(Types::Class, classStr(XXXParmTableField)),
AifCollectionTypeAttribute('_tableFieldList', Types::Class, classStr(XXXParmTableField)),
AifCollectionTypeAttribute('return', Types::Class, classStr(XXXParmTableField))
]
public List parmTableFieldList(List _tableFieldList = tableFieldList)
{
if (!prmIsDefault(_tableFieldList))
{
tableFieldList = _tableFieldList;
}
return tableFieldList;
}