Array::create Method [AX 2012]
Creates an array from the container that is obtained from a previous call to the Array.pack method.
client server public static Array create(container container)
Run On
CalledParameters
- container
- Type: container
A container that is created by using the Array.pack method. The container is unpacked to create an array.
The following example creates an array and adds two sets to it. The array is packed and then used to create a new array.
{
Array myArray;
Array newArray;
container packedArray;
Set set1 = new Set(Types::Integer);
Set set2 = new Set(Types::Integer);
int i;
int j;
myArray = new Array(Types::Class);
// Add some values to the set1 and set2
for (i = 0; i < 10; i++)
{
set1.add(i);
j = i+3;
set2.add(j);
}
// Add set1 and set2 to myArray
myArray.value(1, set1);
myArray.value(2, set2);
// Pack the myArray into a container
packedArray = myArray.pack();
// Create a new array from the container
if(packedArray != connull())
{
newArray = Array::create(packedArray);
}
// Test that newArray has same contents as myArray
print newArray.definitionString();
print newArray.toString();
pause;
}
Show: