table.QUERY_FROM_RANGE Function


Result_Flag as L = Query_From_Range()


Create a query from the current range, if one is in effect - returns .T. if new query created.


The <TBL>.QUERY_FROM_RANGE() method converts the current range into a query. A query is static, whereas a range is dynamic. You might want to convert a range to a query so as to get a count of the number of records in a range, or to prevent the range of records from changing dynamically. Result_Flag is .T. if the query was successfully created (i.e. a range was in effect), and is .F. if the query was not created (i.e. there was no range in effect)


The following code generates two queries, then deletes them

tbl ="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()
'now, set the primary index to lastname order

See Also