GetNextRecord()

Summary

Gets the next record in a view or selection set based on a sort order.

Syntax

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

Argument Contents
view_set The view and the set of records to consider
start_record_handle A "starting point" from which the next 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 elements are 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 next record in the input view or set when sorted as specified; or null if the starting record is the last record.

Notes

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

  • GetNextRecord() performs any necessary indexing automatically.

  • 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 = GetFirstRecord("U.S. States|", order)
while rh <> null do
// Process the record
rh = GetNextRecord("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; a field in the sort_order array does not exist; or the start record is not in the set or was 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
GetPrevRecord() Finds the previous 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