Click or drag to resize

DbServer.OrderDescend Method

Return and optionally change the descending flag of an order.

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.7
	uOrder AS USUAL := NIL,
	oFSIndex AS USUAL := NIL,
Request Example View Source


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.
oFSIndex (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 <oFSIndex> is not open by the current process, a runtime error is raised.
lNew (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: Usual
If lNew is not specified, DBServer:OrderDescend() returns the current setting.  If <lNewDescend> is specified, the previous setting is returned.
DBServer:OrderDescend() changes the ascending/descending flag at runtime only — it does not change the descending flag stored in the actual index file.
Tip Tip
If you are using DbServer:OrderDescend() with Scopes, you need to swap the Top and Bottom scope values !
1oServer:OrderScope (TOPSCOPE, cFrom)
2oServer:OrderScope (BOTTOMSCOPE, cTo)
3oServer:OrderDescend(,, TRUE)
4oServer:OrderScope (TOPSCOPE, cTo)
5oServer:OrderScope (BOTTOMSCOPE, cFrom)
The following example illustrates DBServer:OrderDescend(); every order can be both ascending and descending:
 1LOCAL oDBCust AS DBServer
 2oDBCust := Customer{}
 3oDBCust:CreateOrder("Last", "customer", "oDBCust:LastName")
 4oDBCust:SetOrderCondition(,,,,,,,,,, TRUE)
 5oDBCust:CreateOrder("First", "customer", "oDBCust:FirstName")
 6oDBCust:SetOrder("Last")        // Last was originally created in ascending order
 7oDBCust:OrderDescend(,, TRUE)    // Swap it to descending
 8// Last will now be processed in descending order
 9oDBCust:SetOrder("First")        // First was originally created in descending order
10oDBCust:OrderDescend(,, FALSE)    // Swap it to ascending
11// First will now be processed in ascending order
See Also