The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



SortRowNames


Unit:SDL_datatable
Class: TDataTable
Declaration: [1] procedure SortRowNames (Ascending: boolean; LowCol, LowRow, HighCol, HighRow: integer);
[2] procedure SortRowNames (Ascending, IgnoreCase: boolean; LowCol, LowRow, HighCol, HighRow: integer);

The method SortRowNames sorts the data contained in the range [LowCol,LowRow] to [HighCol,HighRow], the row names, and the row attributes according to the row names. The values outside this range are not affected. The parameter Ascending specifies whether the valus are to be sorted in ascending (TRUE) or descending (FALSE) order. The additional parameter IgnoreCase in version [2] of this method controls whether lower and upper case letters are distinguished. The event OnSortExchange is triggered whenever two columns have to be exchanged during the sorting process.

The sorting is performed by a modified bubble sort (CombSort), which has been reported to be comparable in speed to QuickSort (see also R.Box, S. Lacey, BYTE magazine, April 1991).

Hint: Setting both the low and high parameter of a dimension (i.e. LowCol and HighCol) to zero values forces the method to use all elements of that dimension.

Example: The statement MyDTable.SortRowNames (true, 1, 1, MyDTable.NrOfColumns, MyDTable.NrOfRows) sorts the whole matrix MyDTable in ascending order according to the row names.


Last Update: 2012-Oct-20