Sort or Order a Table at Run Time Sample
File: ...\Samples\Solution\Db\Order.scx
This sample illustrates changing the order in which records in a table are listed. The customer table has index tags on the fields displayed in the grid. In the MouseUp event of each of the headers in the grid, the order of the table is set to the index tag associated with the field displayed in the column. For example, the following code is associated with the MouseUp event of the Company header:
LPARAMETERS nButton, nShift, nXCoord, nYCoord
IF nShift = 2 && CTRL
SET ORDER TO Company DESCENDING
ELSE
SET ORDER TO Company ASCENDING
ENDIF
GO TOP
THISFORM.Refresh