The Selection to Array command copies data in the fields or record numbers from the current selection into the array(s) created and the order of this resulting array(s) will have the same order as the order of the current selection. For instance in the code below,
SELECTION TO ARRAY([Customer]CustomerID;CustID)
the current selection of the Customer table is sorted by the Customer’s Last name in ascending order. When the Selection to Array command is executed above, the CustID array will contain IDs of Customer in the current order of the current selection, thus, containing elements in the order of the Customer’s last name. The order of the resulting array holds true for the Selection Range to Array command also.