Code example of how to use the List datastructure

The list is a usefull datastructure that can contain any type of x++ types.

Here are some code examples of how it can be used.


First Example
List list = new List(Types::Integer);
Enumerator en ;
list.addEnd(333333); // add the value at last
list.addEnd(111111);
list.addEnd(222222);
en = list.getEnumerator();
print list.elements(); //"print number of element"

while (en.moveNext())
{
print en.current();
}
pause;
Second Example
List list1 = new List(Types::Integer);
List list2 = new List(Types::Integer);
List combinedList = new List(Types::Integer);
int i;
;
for(i=1; i<6; i++)
{
List1.addEnd(i);
}
for(i=6; i<11; i++)
{
List2.addEnd(i);
}
combinedList = List::merge(list1, list2);
print combinedList.toString();
pause;


Copied from here

Comments

Popular posts from this blog

D365FO Data management change tracking enable/disable not working

Displaying a value from a array field in EP

Table array field iteration