ComponentOne True DataControl 8.0
QuickSort Method (XArrayDB)

Syntax

XArrayDB.QuickSort rowstart, rowend, column1, order1, type1 [, …, column10, order10, type10]

Method applies to XArrayDB object.

Arguments

rowstart is a long integer specifying the first row to be sorted.

rowend is a long integer specifying the last row to be sorted.

column1 through column10 are long integers specifying the indexes of the columns to be sorted, in the order in which they are applied.

order1 through order10 are XORDER constants specifying the sort order of the columns.

type1 through type10 are XTYPE constants specifying the data type used to coerce column values during comparison.

Return Value

None

Description

The QuickSort method sorts a range of rows in an XArrayDB object according to the specified column(s). The optional arguments must be specified in groups of three. That is, if you supply a column argument, you must supply its order and type arguments as well. You must provide at least one argument triplet, otherwise a trappable error will occur.

Example

The following example initializes a single-column XArrayDB object containing date values in a variety of formats, then uses the QuickSort method to reorder the array in ascending order:

MyArray.ReDim 1, 4, 1, 1

MyArray(1, 1) = DateSerial(1998, 2, 11) ' date

MyArray(2, 1) = "January 22, 1998"      ' string

MyArray(3, 1) = #10/4/1998#             ' date literal

MyArray(4, 1) = CLng(#1/27/1998#)       ' long integer

 

' sort all rows of the array

MyArray.QuickSort 1, 4, 1, XORDER_ASCEND, XTYPE_DATE

 

' print the results

Debug.Print MyArray(1, 1) ' prints January 22, 1998

Debug.Print MyArray(2, 1) ' prints 35822

Debug.Print MyArray(3, 1) ' prints 2/11/98

Debug.Print MyArray(4, 1) ' prints 10/4/98

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback