Collection classes X++, Maps , list

 

ClassDescriptionData typesAccess
ListValues stored sequentially with ability to add values at the beginning or end of the listAll values must be the same data typeUse ListIterator or ListEnumerator
SetValues stored non-sequentially. Duplicates are not added to the set.All values must be the same data typeUse SetIterator or SetEnumerator
MapValues stored by using a unique key.The key and the value need not be from the same data type.Use MapIterator or MapEnumerator
StructValues stored by using a unique string as a keyThe 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

Popular posts from this blog

Ledger dimensions and financial Dimensions X++

Logistics address, postal address, address phone fax contact information

Consume odata/web api d365fo and parsing json content