table.INDEX_GET Function


as P = Index_Get(C tagname)



The name of an index or query list description.


Returns an index given a name.


The .INDEX_GET() method returns an pointer to an index or query list specified by Tag_Name for a table. Once you have a reference to an index tag or query list, you can use the various methods for an index pointer (such as .RECORDS_GET()to determine the number of records in the index tag or query list). If the index tag is not found in the index file or the query list does not exist,the method returns the closest match, as shown below:. Note : The .INDEX_GET() method does not set Tag_Name as the primary index.

idxtbl ="maint_bills_test", FILE_RW_SHARED) 
 indx = idxtbl.index_get("facility")
? indx.name_get() 
 = "Facil"


This script sets the primary index to Lastname.

dim tbl as P
tbl = table.current()
indx = tbl.index_get("Lastname")

Since <TBL>.INDEX_PRIMARY_PUT() also can take a tag name as an argument, this script could be written more simply as follows.

dim tbl as P
tbl = table.current()

This script gets a count of the number of keys in an index tag.

dim tbl as P
tbl = table.current()
indx = tbl.index_get("CA Customers")
count = indx.records_get()

See Also