GetPrevRecord()

Summary

Finds the previous record in a view or selection set based on a sort order.

Syntax

record_handle = GetPrevRecord(string view_set, string start_record_handle, array sort_order)

Argument Contents
view_set The view and set of records to consider
start_record_handle A "starting point" from which the previous record is derived, or null to start from the current record
sort_order An array indicating the desired sort order, or null for natural order. The array contains an array of field name-order pairs:
Element Type Contents
1 String The name of the field
2 String "Ascending" or "Descending"

Returns

A string indicating the record handle for the previous record in the input view or set when sorted as specified; or null if the starting record is the first record.

Notes

  • The returned record is also set as the current record.

  • GetPrevRecord() performs any necessary indexing.

  • The first pair in the sort_order array specifies the primary sort order. The second pair, if present, specifies the secondary sort order, and so on.

Example

order = {{"Population", "Descending"}}
rh = GetLastRecord("U.S. States|", order)
while rh <> null do
// Process the record
rh = GetPrevRecord("U.S. States|", null, order)
end

Error Codes

Error Type Meaning
Error Start_record_handle is invalid; or start_record_handle is null and the input view has no current record
NotFound The specified view or set does not exist; or a field in the sort_order array does not exist; or the original record is not in the set or has been deleted from the view.

See Also

Function Summary
GetFirstRecord() Finds the first record in a view or selection set based on a sort order
GetLastRecord() Gets the last record in a view or selection set based on a sort order
GetNextRecord() Gets the next record in a view or selection set based on a sort order
GetRecord() Gets the record handle of the current record of a view
GetRecords() Gets an array of record handles for a selection set
LocateRecord() Locates a record based on the value of a field
SetRecord() Sets the current record of a view