table.QUERY_DETACH_ALL Function

Syntax

V Query_Detach_All()

Description

Detach all queries.

Discussion

The <TBL>.QUERY_DETACH_ALL() method detaches all temporary queries from a table. When you use the <TBL>.QUERY_CREATE() method to create a new query, Alpha Anywhere will check to see if a previously run query matches the criteria you have specified. If one does, Alpha Anywhere will use the previously run query, rather than running a new query, as long as Alpha Anywhere determines that the existing query is not out of date. Alpha Anywhere relies on the query's date/time stamp to determine if it is out of date. This method may not be foolproof. To eliminate the possibility of Alpha Anywhere using an out of date query, it may be prudent to remove all queries from a table. Using an out of date query may result in certain records not being found, even though they are in the table.

Example 

The following code generates two queries, then deletes them

tbl = table.open("customer")
Query.filter = "state = 'ma'"
indx = tbl.query_create()
Records1 = tbl.records_get()
Query.filter = "state = 'ca'"
indx = tbl.query_create()
Records2 = tbl.records_get()
tbl.query_detach_all()
'now, set the primary index to lastname order
tbl.index_primary_put("lastname")

See Also