DESCEND()
Create a descending index key value
------------------------------------------------------------------------------
SyntaxDESCEND(<exp>) --> ValueInvertedArguments<exp> is any valid expression of character, date, logical, or
numeric type. Memo type is treated in the same way as character type.
Returns
DESCEND() returns an inverted expression of the same data type as the
<exp>, except for dates which return a numeric value. A DESCEND() of
CHR(0) always returns CHR(0).
Description
DESCEND() is a conversion function that returns the inverted form of the
specified expression to be used with INDEX to create descending order
indexes. Specify that part of the index expression you want to be
descending as the DESCEND() argument. To subsequently perform a lookup
with SEEK, specify DESCEND() in the search expression.
Notes. The preferred way to create a descending index is to use the
DESCENDing clause of the INDEX command. Using DESCENDING is the same
as specifying the DESCEND() function, but without the performance
penalty during index updates. If you create a DESCENDING index, you
will not need to use the DESCEND() function during a SEEK.
DESCENDING is an attribute of the index (.ntx) file, where it is
stored and used for REINDEXing purposes.
Examples. This example uses DESCEND() in an INDEX expression to create a
descending order date index:
USE Sales NEW
INDEX ON DESCEND(OrdDate) TO SalesDate
Later, use DESCEND() to SEEK on the descending index:
SEEK DESCEND(dFindDate)
. This example illustrates how to create a descending order
index using more than one data type. Here, the key is created using
the concatenation of date and character fields after the appropriate
type conversion has taken place. This example uses STR() instead of
DTOS(), since DESCEND() of a date returns a numeric value:
USE Sales NEW
INDEX ON STR(DESCEND(SaleDate)) + Salesman TO LastSale
Files Library is EXTEND.LIB.