Click or drag to resize

VoDbOrdSetFocus Function

X#
Set the controlling order for a work area.
Set the controlling order for a work area.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION VoDbOrdSetFocus(
	cIndexFile AS STRING,
	uOrder AS USUAL,
	cOrder OUT STRING
) AS LOGIC
Request Example View Source

Parameters

cIndexFile
Type: String
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.
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.
cOrder
Type: String
This returns the previous order that was selected.

Return Value

Type: Logic
TRUE if successful; otherwise, FALSE.

Return Value

Type: Logic
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
Remarks
VODBOrdSetFocus() is similar to DBSetOrder() except that it is strongly typed and the order of the arguments is reversed.
Also, the third argument pszPreviousOrder points to the old controlling order. This function, however, does not call the error handler and will not, therefore, produce a runtime error message or create an error object if it fails. Thus, it may be important to check the return value to determine if the function succeeded.
the LastRddError property in the runtime state. will contain needed information regarding any error that occurs.
See DbSetOrderCondition(Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual) for more information
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")
Examples