Click or drag to resize

VoDbOrdListRebuild Function

X#
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.19
Syntax
 FUNCTION VoDbOrdListRebuild() AS LOGIC
Request Example View Source

Return Value

Type: Logic
TRUE if successful; otherwise FALSE.

Return Value

Type: Logic
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 SetExclusive() 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 LastRddError property in the runtime state. will contain needed information regarding any error that occurs.
Examples
This example issues a DBReindex() if a particular record is not found:
X#
 1DBUseArea(TRUE,, "Address")
 2DBGoBottom()
 3DBUseArea(TRUE,, "customer",, FALSE)
 4    //Opens the file exclusively
 5DBSetIndex("CustID")
 6DBSeek(Address->Cust_ID)
 7IF !Found()
 8    ? "Referential integrity failure:"
 9    ? "The last Address record was not found in the"
10    ? "Customer index file. Index is not up-to-date"
11    ? "or the record is missing.  Reindexing ..."
12    IF !DBReindex()
13        ? "Reindexing failed"
14        DBCloseAll()
15        QUIT
16    ENDIF
17ENDIF
Examples