by Matthew J. Cavallari (1 Submission)
Category: VB function enhancement
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)
A class library with one public array sorting function and four supporting private functions. The primary work done by the library is done by the recursively called function MultiSortRecur, which sorts any two dimensional array, given the array to be sorted and the order over which the array's second dimension will be sorted. It uses a divide and conquer type algorithm (similar to a QuickSort).
An example of usage would be where a two dimensional array is seen as a type of recordset where the first dimension describes the rows and the second dimension describes the fields collection. The recordset (array) can then be multisorted according to column order in ascending or descending order. (i.e. have the the array sorted by 4th column as ascending and upon those which items match, then 2nd column as descending, etc.
Inputs
The public function MultiSort takes two parameters:
1: a two dimensional array to be sorted
2: a sort order array of optional length (ParamArray) which describes the column sort order and order type
Code Returns
no returns
Side Effects
none that are known of