• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

RecordSet.sort( ) Method > RecordSet.sort( ) Method

Name

RecordSet.sort( ) Method

Synopsis

                     myRecordSet.sort(compareFunction)

Arguments

compareFunction

A custom function that facilitates the sort of the recordset by comparing records.

Description

The sort( ) method sorts a RecordSet object in place using a user-specified sort function. The compare function should compare two records (which are passed as two arguments to the function) and return a positive number if the first record is greater than the second record, a negative number if the second record is greater, and 0 otherwise.

Example

The following code demonstrates the sort( ) method on a RecordSet object, sorting by last name and then first name using a custom sortByFirstAndLast( ) function:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint