KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: The order of the resulting array of the Selection to Array command
PRODUCT: 4D | VERSION: 2004.4 | PLATFORM: Mac & Win
Published On: October 23, 2006

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,
ORDER BY([Customer];[Customer]LName;>)
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.