bOk = MTblSort( hWndTbl, hWndaCols[*], naColSortFlags[*] )

Sorts a table.

Parameters
hWndTbl
Window Handle: Handle of the table

hWndaCols[*]
Array of Window Handle: Handles of the columns to sort.

naColSortFlags[*]
Array of Number: Column sort flags.

Return
Boolean: TRUE if successful or FALSE if an error occurs

Example
In this example a table is sorted by two columns, the first ascending with default data type and the second descending with custom data type. We assume that the second column contains month names, e.g. "January" or "December".

If NOT SalArrayIsEmpty( hWndaCols )
  Call SalArraySetUpperBound( hWndaCols, 1, -1 )
Set hWndaCols[0] = col1
Set naSortFlags[0] = MTS_ASC | MTS_DT_DEFAULT
Set hWndaCols[1] = col2
Set naSortFlags[1] = MTS_DESC | MTS_DT_CUSTOM
Call MTblSort( hWndTbl, hWndaCols, naSortFlags )
Child Table: tbl1
  Message Actions:
    On MTM_QuerySortValue
      Set hWndCol = SalNumberToWindowHandle( wParam )
      SalGetItemName( hWndCol, sItemName )
      If sItemName = "col2"
        ! GetMonthNr returns the month number, e.g. 1 for "January" and 12 for "December"
        Return GetMonthNr( col2 )      

Remarks
Split rows are not supported.
If you're using row hierarchy, you can restore the hierarchical structure with a call to MTblSortTree.

See also
Extended sorting

Created with the Personal Edition of HelpNDoc: Easily create Help documents