<< Click to Display Table of Contents >> Navigation: Apollo API Listing > sx_IndexTag |
Declare Function sx_IndexTag Lib "Apollo9.dll"
(ByVal cpFileName As Any,
ByVal cpTagName As String,
ByVal cpExpr As String,
ByVal iOption As Integer,
ByVal bDescend As Integer,
ByVal cpCondition As Any)
As Integer
SHORT sx_IndexTag
(BYTEP cpFileName,
BYTEP cpTagName,
BYTEP cpExpr,
SHORT iOption,
BOOL bDescend,
BYTEP cpCondition);
Creates a new tag in the compound .CDX or .NSX index referenced by cpFileName. If the .CDX/.NSX file does not already exist, it will be created. A tag may be added only to .CDX/.NSX files that have had their corresponding .DBF opened for EXCLUSIVE use. To create single-order .IDX/.NTX index files, use the sx_Index function instead.
The progress of the function may be visually monitored if a gauge hook has been set with sx_SetGaugeHook.
cpFileName: The name of the .CDX or .NSX index file. If this file does not already exist, it will be created. If this value is passed as a NULL string (0&), then the name of the .CDX or .NSX index will be the same as the .DBF in use and will become a structural index. A structural index should only contain permanent indexes. Create non-structural .NSX indexes for use as temporary indexes when using the SDENSX driver. When using the SDEFOX driver, use sx_Index to create single .IDX files instead of a .CDX tag.
cpTagName: A unique name for the separate index being created within the compound index. Maximum tag name length is 10 characters and the name should begin with an alphabetic character. Do not add extensions to tag names.
cpExpr: A string containing the indexing expression using xBase syntax.
iOption: One of the following constant values:
IDX_NONE 0 Standard index (Not UNIQUE or EMPTY (RYO))
IDX_UNIQUE 1 UNIQUE, allows unique keys only
IDX_EMPTY 2 Roll-Your-Own (RYO) empty index header
bDescend: When passed as True will create a descending index.
cpCondition: If you wish to construct a conditional order that contains a subset of the table, pass an xBase conditional expression (i.e., one that can be evaluated logically) in this parameter. If the order is to contain all of the records in the table, pass this parameter as a NULL string (0&).
The use of a conditional index makes it appear that the table only contains records that satisfy the condition (e.g., 'upper(trim(country)) = 'GERMANY'"). Indexes will be properly maintained as records in the table are added, deleted, or changed.
The order select area of the index created (i.e., the TAG). Zero is returned if an error occurs in the creation of the tag,
If no path is supplied for cpFileName, the following is the search order:
1.The current directory.
2.The Windows directory.
3.The Windows System directory.
4.The directory containing the executable file for the current task.
5.The directories listed in the PATH environment variable.
6.Network mapped directories.
iDbfArea = sx_Use("\vb\idx\test.dbf", "test", EXCLUSIVE, SDEFOX)
If iDbfArea > 0 Then
iTag1 = sx_IndexTag(0&, "name", "upper(last)", IDX_NONE, 0, 0&)
iTag2 = sx_IndexTag(0&, "salary", "salary", IDX_NONE, 0, 0&)
End If
SHORT iTag1, iTag2;
if (sx_Use("\\vb\\idx\\test.dbf", "test", EXCLUSIVE, SDEFOX) > 0)
{
iTag1 = sx_IndexTag( NULL, "name", "upper(last)", IDX_NONE, 0, NULL);
iTag2 = sx_IndexTag( NULL, "salary", "salary", IDX_UNIQUE | IDX_EMPTY,
0, NULL);
}
sx_Index, sx_IndexClose, sx_IndexKey, sx_IndexName, sx_IndexOrd, sx_IndexTag, sx_Reindex, sx_SetGaugeHook, sx_SetOrder, sx_TagArea, sx_TagName, xBase Expressions Supported