SetRowOrder()

Summary

Sets the order in which rows appear in an editor.

Syntax

SetRowOrder(string editor_name, array sort_sequence)

Argument Contents
editor_name The name of the editor, or null for the current editor
sort_sequence An array of fieldname-direction pairs (see below)

Notes

  • The sort_sequence is an array of fieldname/direction pairs. Each pair is an array of two elements: a fieldname in the editor's view and a string specifying whether the field should be sorted Ascending or Descending. The first pair in the sort_sequence array specifies the primary sort key; the second pair specifies the secondary sort key, etc.

  • If sort_sequence is null, the editor displays rows in the natural order of its view and set.

Example

// Sort the county editor by state, and within each state by decreasing population
SetRowOrder("Counties",
{{"State", "Ascending"}, {"Population", "Descending"}})
// Now put the records back in natural order
SetRowOrder("Counties", null)

Error Codes

Error Type Meaning
Escape The user interrupted an indexing operation
NotFound The specified editor or one of the specified fields does not exist.
Error An error occurred sorting the rows; not enough disk space for a temporary index file

See Also

Function Summary
GetColumnArray() Gets a list of the columns displayed in an editor
GetRowOrder() Gets the order of rows in an editor
GetFirstRecord() Finds the first record in a view or selection set based on a sort order
SetColumnArray() Sets the columns displayed in an editor
SortSet() Sorts the records in a selection set based on the values of one or more fields