contents   index   previous   next

Cursor sort




A property containing the sort order of a cursor. The Cursor sort order will determine the order that the rows are returned in when iterating the Cursor. The sort property is a string that contains the ORDER BY clause of an SQL statement. It does not include the reserved word ORDER BY, however. Initially, the sort property is set to the empty string, and, therefore, no item sort order is guaranteed. Call reload after changing the sort order to update the contents of the Cursor.



#link <sedbc>, Cursor reload()



// assume 'database' is a valid Database object

var curs = database.table("customer")


// Set sort order so that the Cursor is sorted

// first by the

// 'city' field, and, for records

// with the same 'city' value,

// descending by the field 'name'.

curs.sort = "city, name DESC";


// Reload the cursor

err = curs.reload();



Cursor Instance Methods