Click or drag to resize

VoDbOrdListRebuild Function

Rebuild all orders in the order list of a work area.
Rebuild all orders in the order list of a work area.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax
 FUNCTION VoDbOrdListRebuild() AS LOGIC
View Source

Return Value

Type: Boolean
TRUE if successful; otherwise FALSE.

Return Value

Type: Boolean
Remarks
By default, this function operates on the currently selected work area.  It can be made to operate on an unselected work area by specifying it within an aliased expression. All orders are rebuilt, respecting uniqueness and descending order flags and the for condition specified when the order was created.  After the orders are rebuilt, the work area is positioned to the first logical record in the controlling order. Although this operation will work in both shared and exclusive mode, exclusive mode is highly recommended.  See both SetExclusive() and "Concurrency Control" in the Programmer's Guide for more information. Caution!  DBReindex() does not recreate the header of the index file when it recreates the order.  Because of this, DBReindex() does not help if there is corruption of the file header.  To guarantee a valid index, always use DBCreateIndex() in place of DBReindex() to rebuild damaged index files
Remarks
VODBOrdListRebuild() is the same as DBReindex() except that it is strongly typed.  This function, however, does not call the error handler and will not, therefore, produce a runtime error message or create an error object if it fails.  Thus, it may be important to check the return value to determine if the function succeeded.  The global structure, StrucErrInfo, will contain needed information regarding any error that occurs.
Examples
This example issues a DBReindex() if a particular record is not found:
X#
DBUseArea(TRUE,, "Address")
DBGoBottom()
DBUseArea(TRUE,, "customer",, FALSE)
        //Opens the file exclusively
DBSetIndex("CustID")
DBSeek(Address->Cust_ID)
IF !Found()
        ? "Referential integrity failure:"
        ? "The last Address record was not found in the"
        ? "Customer index file. Index is not up-to-date"
        ? "or the record is missing.  Reindexing ..."
        IF !DBReindex()
                ? "Reindexing failed"
                DBCloseAll()
                QUIT
        ENDIF
ENDIF
Examples