Collection classes X++, Maps , list
Class | Description | Data types | Access |
List | Values stored sequentially with ability to add values at the beginning or end of the list | All values must be the same data type | Use ListIterator or ListEnumerator |
Set | Values stored non-sequentially. Duplicates are not added to the set. | All values must be the same data type | Use SetIterator or SetEnumerator |
Map | Values stored by using a unique key. | The key and the value need not be from the same data type. | Use MapIterator or MapEnumerator |
Struct | Values stored by using a unique string as a key | The key must be a string. The values can be of any type. | Provide the string key to the value method |
Set Class examples
Set coffeeReceiptSet = new Set(Types::String);
if(coffeeReceiptSet.in(weightView.BFSIndependentWeighID))
{
continue;
}
else
{
coffeeReceiptSet.add(weightView.BFSIndependentWeighID);
}
Map class examples
Map openTransMap = new Map(Types::Int64, Types::Real);
if (!openTransMap.exists(SpecTransNew.OpenTransRecId))
{
openTransMap.insert(SpecTransNew.OpenTransRecId, SpecTransNew.DebitNoteAmt);
}
else
{
openTransMap.insert(SpecTransNew.OpenTransRecId, openTransMap.lookup(SpecTransNew.OpenTransRecId) + SpecTransNew.DebitNoteAmt);
}
MapEnumerator mapEnumerator = openTransMap.getEnumerator();
while (mapEnumerator.moveNext())
{
mapRecId = mapEnumerator.currentKey();
mapAmt = mapEnumerator.currentValue();
}
Container class examples
container attributesCon = conIns(attributesCon,noSampleRecords,contractLine.recid);
for (i = 1; i<=conLen(attributesCon); i++)
{
attributesChildCon = conPeek(attributesCon, i);
}
Comments
Post a Comment