Sort Object

Sort object is a member of the data object.  It defines how the data should be sorted when fetching records from the underlying database table.

The object is exposed through the ISort interface.

Methods

Set

Sets a sorting order. Set the first parameter to Empty to flush the current sorting.

Function Set( field(s), direction(optional, default - ascending) )

Parameters:
variant field(s) - a field name or an array of field names specifying field(s) to be used for sorting.
variant direction - boolean or an array of boolean values corresponding to each field in the fields array - true: ascending order; false: descending order.

Return value:
none

Sort.Set Array( "Field1", "Field2" ), Array( true, false )

Get

Returns the current sorting order.

Function Get()

Parameters:
none

Return value:
variant - Empty: no sorting order.  Otherwise, a two element array: the first element is an array of fields, the second array contains the direction of sorting for the corresponding field. true: ascending order; false: descending order

Dim order

order = Sort.Get()
If Not IsEmpty( order ) Then
   Target.Message order(0)(0) & " First field"
   Target.Message order(0)(1) & " Second field"
End If


Comments