extract() function

The extract() function retrieves a specific attribute, value, or subvalue from a dimensioned or dynamic array.


extract(dyn.array.exp, ac.exp)
extract(dyn.array.exp, ac.exp, vc.exp)
extract(dyn.array.exp, ac.exp, vc.exp, sc.exp)


dyn.array.exp Array from which the specified attribute, value, or subvalue is extracted.
ac.exp Attribute to extract.
vc.exp Value to extract.
sc.exp Subvalue to extract.


extract() makes a copy of an element in a dynamic array rather than physically removing the element. The original syntax of the extract() function is equally as valid as the dynamic array reference method.

Alternate method, using dynamic array reference symbols:

dyn.array.var< ac.exp>
dyn.array.var< ac.exp, vc.exp>
dyn.array.var< ac.exp, vc.exp,...
... sc.exp>
Note: An extract of attribute 0 is undefined and should be avoided.


All of these examples retrieve the entire first attribute from the dynamic array, customer.item.

print extract(customer.item,1,0,0)
print extract(customer.item,1)
print customer.item<1>

Both of these examples retrieve the second value from the first attribute of the dynamic array, customer.item.

print extract(customer.item(1),1,2)
print customer.item(1)<1,2>

Both of these examples assign the variable name to the first value from the first attribute of the array customer.item.

name = extract(customer.item(1),1,1)
name = customer.item(1)<1,1>