table.INDEX_CREATE_END Function

Syntax

as P = Index_Create_End([C Indexname])

Arguments

Indexname

Optional. Default = the table's production index. The table's production index has the same name as the table (with a .CDX extension), and it is opened automatically when the table is opened. A table file name with .CDX extension.

Description

Complete creation of an index.

Discussion

The .INDEX_CREATE_END() method creates a new index file for the table referenced by the pointer. An object pointer ( ) is returned as a reference to the first tag in the new index file. If you supply the Filename, and it is different than the table name, the index file is not a production index, meaning that you are responsible for opening the index file yourself, using the .INDEX_OPEN() method, when you open the table. The .INDEX_CREATE_END() method is used in conjunction with the TABLE.INDEX_CREATE_BEGIN() and TABLE.INDEX_ADD() methods. Note : 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.

dim tbl as P
tbl = table.current()
Table.index_create_begin("LASTNAME", "LAST_NAME")
Table.index_add("FIRSTNAME", "FIRST_NAME")
index_pointer = 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.

dim tbl as P
tbl = table.current()
Table.index_create_begin("CA customers", "LAST_NAME", "State_prov = 'CA'", "U")
index2 = tbl.index_create_end(a5.get_path()+ chr(92) + "temp.cdx")

See Also