The method SortVector sorts the values of the vector Data in an order which depends on parameter Ascending. The integer array Index returns the new sort order (assuming that the initial values are numbered from 1 to length(Data)) and is automatically resized to match the Data array.
The function returns the following error codes:
0 .... everything OK
-1 ... the size of the Data array is less than 2