Click or drag to resize

OrdSetFocus Function

X#
Set the controlling order for a work area.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION OrdSetFocus(
	uOrder,
	cIndexFile
) AS USUAL CLIPPER
Request Example View Source

Parameters

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: Usual
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#
1USE employee NEW
2Employee->DBSetIndex("name")
3Employee->DBSetIndex("age")
4DBSetOrder("age")
See Also