Click or drag to resize

DbSetOrder Function

Set the controlling order for a work area.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.7
	uOrder AS USUAL := NIL,
	cIndexFile AS USUAL := NIL
Request Example View Source


uOrder (Optional)
Type: Usual
The name of the new controlling order or a number representing its position in the order list.
Using the order name is the preferred method since the position may be difficult to determine using multiple-order index files.  Specifying a value of 0 has the special effect of returning the database file to its natural order.  Specifying an invalid value will raise a runtime error.
cIndexFile (Optional)
Type: Usual
The name of an index file, including an optional drive and directory (no extension should be specified).
Use this argument with <cOrder> to remove ambiguity when there are two or more orders with the same name in different index files.
If <cIndexFile> is not open by the current process, a runtime error is raised.

Return Value

Type: Boolean
TRUE if successful; otherwise, FALSE.
DBSetOrder() controls which of the orders in a work area's order list is the controlling order.
The controlling order is the one that determines the logical order of records in the work area.  Before using this function, use DBSetIndex() to add orders from an index file to the order list. By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying it within an aliased expression
This example sets the second named order, AGE, as the controlling order:
1USE employee NEW
See Also