xHarbour Reference Documentation > Function Reference |
Converts a value for a descending index.
Descend( <xValue> ) --> xDescend
The function returns the converted value suitable for creating a descending index. The data type is the same as for <xValue>, except for Date values. The converted value for Dates is of numeric data type.
Descend() is a utility function that can be used for the creation of a descending index. The argument passed to Descend() is converted so that the resulting value is sorted logically like the initial value in descending order. Any portion of an index expression can include the Descend() function. This allows for sorting partial index expressions in descending order. Any subsequent SEEK operations must convert the searched value using Descend().
If the entire index should be created in descending order, it is recommended to use the DESCENDING option of the INDEX command. This is advantageous since searched values do not need to be converted with Descend().
See also: | CtoD(), DbSeek(), DtoC(), DtoS(), INDEX, OrdCondSet(), OrdCreate(), OrdDescend(), SEEK, Str(), Val() |
Category: | Conversion functions |
Source: | rtl\descend.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example creates a descending index using the Descend() // function and outlines how to search in such an index with SEEK. PROCEDURE Main ? Descend( 789 ) // result: -789 USE Customer NEW INDEX ON Descend(Upper(Lastname)) TO Temp GO TOP ? FIELD->Lastname // result: Waters GO BOTTOM ? FIELD->Lastname // result: Alberts SEEK Descend( "KELLER" ) ? FIELD->Lastname // result: Keller USE RETURN
http://www.xHarbour.com