table.INDEX_ADD Function

Syntax

V Index_Add(C Tagname,C Order_expression[,C Filter_expression[,C Index_Type]])

Arguments

Tagname

The name of an existing index.

Order_expression

A character order expression that sorts selected records.

Filter_expression

Optional. Default = all entries. A character filter expression that selects index entries.

Index_Type

Optional. Default = "" (Ascending, not unique). A string of character flags that can specify a descending sort order.

"D" = descending
"U" = unique key values
"DU" = unique descending

Description

The .INDEX_ADD() method adds another index tag to the index file created by TABLE.INDEX_CREATE_BEGIN() .

There are higher level functions that may be easier to use. See GET_INDEX_DEFINITIONS(), INDEXES_MATCH_DEFSTRING(), and CREATE_INDEXES().

Example 

Create a new production index file with a first name and a last name index tag.

tbl = table.current()
table.index_create_begin("LASTNAME", "LAST_NAME")
index_add("FIRSTNAME", "FIRST_NAME")
index1 = tbl.index_create_end()

Create a new temporary index file, but explicitly name the index file so that it is not the production index. Filter the index for state = CA, and include unique keys only.

tbl = table.current()
table.index_create_begin("CA customers", "LAST_NAME", "State_prov = 'CA'", "U")
index2 = tbl.index_create_end(a_DB_current_PATH + "temp.cdx")

See Also