Function DbSetDescend() Foundation

Reverses the navigational order of a work area.

Syntax
DbSetDescend( <lDescend> ) --> NIL
Parameters
<lDescend>
A logical value must be passed for <lDescend>. When .T. (true) is specified, the navigational order in the current work area is set to descending, .F. (false) sets the navigational order to ascending.
Return

The return value of DbSetDescend() is always NIL.

Description

The function DbSetDescend() is used to quickly change the navigational order in a work area from ascending to descending and vice versa without the need to create a corresponding index. When .T. (true) is passed to the function, the navigational order is reversed, i.e. all functions and commands that move the record pointer are inverted.

Effect of descending navigation
Function Description
DbGoTop() Positions the record pointer on the last record
DbGoBottom() Positions the record pointer on the first record
DbSkip( 1 ) Moves the record pointer to the previous record
DbSkip(-1 ) Moves the record pointer to the next record
Bof() Returns .T. when attempting to move the record pointer behind the last record
Eof() Returns .T. when attempting to move the record pointer before the first record

The navigational direction is independent of any logical order, or active indexes. Function DbDescend() can be used to check if the navigational order is descending.

Examples
Descending navigation
// The example demonstrates the effect of 
// reversing the navigational direction 

PROCEDURE Main 

   USE Customer 
   ? Recno(), LastRec()     // Result: 1, 22 

   GO BOTTOM 
   ? Recno()                // Result: 22 

   DbSetDescend( .T. ) 

   SKIP -1 
   ? Recno(), Bof()         // Result: 23, .T. 

   GO BOTTOM 
   ? Recno(), Eof()         // Result: 1, .F. 

   SKIP 
   ? Recno(), Eof()         // Result: 1, .T. 

   USE 
RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.