Array.exists Method [AX 2012]
Determines whether a particular array element is valid.
The following example uses the exists method to test whether various elements in an array are valid.
{
array a = new array(types::Integer);
a.value(1, 23);
print a.value(1);
pause;
if (a.exists(7)) // No, only element 1 is initialized
{
print a.value(7);
}
else
{
print "Value does not exist";
}
pause;
//Array positions 2 to 9 padded with default values
a.value(10, 55);
if (a.exists(7)) // Yes, elements 1..10 now initialized
{
print a.value(7);
}
else
{
print "Value does not exist";
}
pause;
}
Community Additions
ADD
Show: