Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Sort - method of object PmDataTable

Description:
The method sorts rows by values in the specified column (the sort always relocates the whole row). The sort can be ascending or descending.
Syntax:
Sort(SortType As Long, vCol As Variant) As Boolean
Calling:
oDataTable.Sort SortType, vCol
Parameters:
SortType(Long) Sort type:
0 - ascending (01..89..AB..YZ..ab..yz)
1 - descending (zy..ba..ZY..BA..98..10)
vCol(Variant) Identification of the column where rows have to be sorted. It must be of the String type or the integer.
If is String, then it is the name of the column.
If is integer >=0, then it is the column index (zero-based index).
If is integer -2, then it means the last column.
Return Values:
true - on success
false - on error. Sorting failed (e.g. incorrect parameters entered).
Note:

The sort is convenient only in the column with values of the same data type (only numbers, only String, only logical or time values).

Sorting of columns of the String data type is processed with respect to the language localisation.

If there are more rows (>1000), then the sort can take non-negligible time.

If the request to sort is, for example, by the column 1 and if the values equal, then by the column 2 - then this can be realized by two calling of the Sort method: at first to sort by the column 2 and then sort by the column 1.

Example:
Sort the 5th column ascending (zero-based index):
oDataTable.Sort 0, 5
PROMOTIC 8.3.21 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice