Xbasic

OBJECT.INDEX_SET Function

Syntax

.Index_set([c index_name ])

Arguments

index_name

The name of an index or query list. A NULL ("") string the form's sort order to record number order.

Description

Select an index or query.

Discussion

The <OBJECT>.INDEX_SET() method applies to:

Browses (for <OBJECT> use either the <BROWSE> pointer or the name of the browse)
Forms (for <OBJECT> use either the <FORM> pointer or the name of the form)

The <OBJECT>.INDEX_SET() method selects an index or query list as the primary index. This method is a wrapper for <TBL>.INDEX_PRIMARY_PUT().

Example

This script is attached to a button on a form. It sets the form's sort order to record number order:

parentform.index_set("")

This script is attached to a button on a form. It displays a dialog with a list of indexes and queries, and allows the user to select an index/query.

dim list[count] as C
t = table.current()
'count the number of indexes/queries
count = 1
while (t.index_name_get(count) != "")
    count = count + 1
end while
count = count - 1
'create an array with the index names
for I = 1 to count
    list[I] = t.index_name_get(I)
next i
index_name = ui_get_list_array("Choose an index", 1, "list")
parentform.index_set(index_name)

For more examples, see the <FORM>.FIND() method.

Limitations

Desktop applications only.

See Also