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.10
Syntax
 FUNCTION DbSetOrder(
	 uOrder AS USUAL,
	 cIndexFile AS USUAL
) AS LOGIC
View Source

Parameters

uOrder
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
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.
Remarks
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
Examples
This example sets the second named order, AGE, as the controlling order:
X#
USE employee NEW
Employee->DBSetIndex("name")
Employee->DBSetIndex("age")
DBSetOrder("age")
See Also

Reference

DBServer:CreateIndex
DBServer:CreateOrder
DBServer:Reindex
DBServer:SetIndex
DBServer:SetOrder
SET ORDER