Open an index file and add all its orders to the order list in a work area.
Open an index file and add specified orders to the order list in a work area.
XSharp.RT (in XSharp.RT.dll) Version: 2.6
Syntax Request Example
cIndexFile AS STRING,
uOrder AS USUAL
) AS LOGIC
public static bool VoDbOrdListAdd(
- Type: String
The name of the index files to open, including an optional drive, directory, and extension for each. See SetDefault() and SetPath() for file searching and creation rules.
The default extension is determined by the RDD and can be obtained using DBOrderInfo(DBOI_INDEXEXT).
If <cIndexFile> does not exist, a runtime error is raised.
If it exists, this function attempts to open the file in the same mode as the corresponding database file.
If access is denied because, for example, another process is using the file and this one is asking for exclusive use, NetErr() is set to TRUE.
Otherwise, the file open is successful.
Concurrency conflicts with index files are rare since they should be used with only one database file.
If a concurrency problem arises, it will normally be when you attempt to open the database file.
- Type: Usual
TRUE if successful; otherwise, FALSE.
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
If the order list for the work area is empty when DBSetIndex() is issued, the first order in the index file becomes the controlling order.
If there are orders already associated with the work area, they are unaffected — the new orders are simply added to the current order list.
After the new index file is opened (using the same open mode as its associated database file), the work area is positioned to the first logical record in the controlling order.
Opening an index file imposes a logical order (defined by the controlling order) on the records in a database file and may also filter the records according to a for condition or a unique flag.
This means that when you process the database file, the records will appear in the order determined by the controlling order and filtered records, although still physically present in the database file, will be inaccessible.
Note: Except for production index files supported by some RDDs, index files are not opened automatically when you open the corresponding database file.
To ensure that index files are accurately maintained, you should either open them prior to making any updates to their corresponding database files or rebuild them at a later time with DBReindex().
VODBOrdListAdd() is the same as DBSetIndex() 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.
The following example opens multiple index files:
1DBUseArea(TRUE, "DBFNTX", "sales", "Sales", TRUE)
5 IF Sales->Deleted() .AND. Sales->RLock()
7 QOut("Deleted record has been recalled.")
10 QOut("Not found")
Examples See Also
SetOrderCondition(Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual) DbSetOrderCondition(Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual, Usual)