User Guide

368 Components Dictionary
Description
Method; searches the current view of the collection for the last item with the field values
specified by
searchValues. Which items are in the current view depends on any current filter
and range settings.
The values specified by
searchValues must be in the same order as the field list specified by
the current sort (see the example below).
Conversion of the data specified is based on the underlying fields type. For example, if the
search value specified is
["05-02-02"], the underlying date field is used to convert the value
with the date’s
setAsString() method. If the value specified is [new Date().getTime()],
the dates
setAsNumber() method is used.
Example
The following example searches for the last item in the current collection whose name and age
fields contain
"Bobby" and "13". If found, DataSet.getItemId() is used to get the unique
identifier for the item in the collection, and
DataSet.locateById() is used to position the
current iterator on that item.
var studentID:String = null;
student_ds.addSort("nameAndAge", ["name", "age"]);
// Locate the last transfer object with the specified values.
// Note that the order of the search fields matches those
// specified in addSort().
if (student_ds.findLast(["Bobby", "13"])) {
studentID = student_ds.getItemId();
}
// Now use locateByID() to position the current iterator
// on the item in the collection whose ID matches studentID.
if (studentID != null) {
student_ds.locateById(studentID);
}
See also
DataSet.applyUpdates(), DataSet.getItemId(), DataSet.locateById()