Create a descending index key value

     DESCEND(<exp>) --> ValueInverted


     <exp> is any valid expression of character, date, logical, or
     numeric type.  Memo type is treated in the same way as character type.


     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).


     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.


     .  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.


     .  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.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.