Click or drag to resize

OrdDescend Function

X#
Return and optionally change the descending flag of an order.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION OrdDescend(
	uOrder,
	cIndexFile,
	lNewDescend
) AS LOGIC CLIPPER
Request Example View Source

Parameters

uOrder (Optional)
Type: Usual
The name of the 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.
If omitted or NIL, the controlling order is assumed.
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.
lNewDescend (Optional)
Type: Usual
TRUE dynamically turns on the descending flag for the order, resulting in descending order. FALSE dynamically turns the flag off, resulting in ascending order.

Return Value

Type: Logic
If lNewDescend is not specified, OrdDescend() returns the current setting.
If lNewDescend is specified, the previous setting is returned.
Remarks
OrdDescend() changes the ascending/descending flag at runtime only — it does not change the descending flag stored in the actual index file. 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
The following example illustrates OrdDescend(), every order can be both ascending and descending.
X#
 1USE customer VIA "DBFCDX"
 2INDEX ON LastName TAG Last
 3INDEX ON FirstName TAG First DESCENDING
 4SET ORDER TO TAG Last
 5// last was originally created in ascending order
 6// Swap it to descending
 7OrdDescend(,, TRUE)
 8// Last will now be processed in descending order
 9SET ORDER TO TAG First
10// First was originally created in descending order
11// Swap it to ascending
12OrdDescend(,, FALSE)
13// First will now be processed in ascending order
See Also