AddSortOrder (add a sort order)

Top  Previous  Next


AddSortOrder( [key] ), PROC


Specifies a sort order for the ViewManager object.


The label of the primary file KEY on which to sort. If omitted, the ViewManager processes in record order.

The AddSortOrder method specifies a sort order for the ViewManager object and returns a number identifying the sequence in which the sort order was added.

Only one sort order is active at a time. The SetSort method sets the active sort order based on the sequence numbers returned by AddSortOrder.


You may specify multiple sort orders by calling AddSortOrder multiple times. The first call to AddSortOrder returns one (1), the second call returns two (2), etc.

Return Data Type:     BYTE


CustSort = MyView.AddSortOrder(ORD:ByCustomer)           !sort by customer no

MyView.AddRange(ORD:CustNo,Relate:Orders,Relate:Customer)!range limit by parent file

OrderSort = MyView.AddSortOrder(ORD:ByOrder)             !sort by order no

MyView.AddRange(ORD:OrderNo)                             !range limit by current

                                                         !value of ORD:OrderNo

!program code

IF MyView.SetSort(CustSort)                              !set active sort order

 DISPLAY                                                 !if changed, refresh


See Also:     SetSort