table.ORDER Function


as P = Table.order(C Order [,C filter [,C flags ]])



A character order expression that sorts selected records.


Optional. Default = ".T." (all records). A character filter expression that evaluates to a logical value. Selects records in the table.




Orders and (optionally) filters a DBF table.


The <TBL>.ORDER() method orders, and optionally filters, data from the table referenced by <TBL>. An object pointer, <INDEX>, is returned. <INDEX> will reference either:

an index that matches Order_Expression and Filter_Expression
if no index matches, a new query list.

Use this method as an alternative to <TBL>.INDEX_PRIMARY_PUT() when you want to specify order and filter expressions, rather than index tag names. An advantage of this method over <TBL>.INDEX_PRIMARY_PUT()is that <TBL>.INDEX_PRIMARY_PUT()could fail if the data dictionary file for a table is missing. The data dictionary contains the long index tag names. In addition to using an index if one is available, <TBL>.ORDER()does not use the global query variables ( query.filter, query.order, etc.).


put description here

dim tbl as P
tbl ="customer")
i = tbl.order("lastname")
i.type_get() ? 2.00000  'indicates that Alpha Anywhere selected an index
i = tbl.order("address2")
? i.type_get() ? 6.00000   'indicates that Alpha Anywhere built a query because no index existed
i = tbl.order("lastname","city = 'boston'")
i = tbl.order("recno()")   'puts table in record number order
i = tbl.order("")   'puts table in record number order

See Also