DataSet.setRange()

Availability

Flash Player 7.

Edition

Flash MX Professional 2004.

Usage

dataSetInstance.setRange(startValues, endValues)

Parameters

startValues An array of key values of the properties of the first transfer object in the range.

endValues An array of key values of the properties of the last transfer object in the range.

Returns

Nothing.

Description

Method; sets the end points for the current iterator. The end points define a range in which the iterator operates. This is only valid if a valid sort has been set for the current iterator by means of DataSet.addSort().

Setting a range for the current iterator is more efficient than using a filter function if you want a grouping of values (see DataSet.filterFunc).

Example

The following example selects a range of students and traces each of their names to the Output panel:

my_ds.addItem({name:"Billy", id:104, gradeLevel:4});
my_ds.addItem({name:"Bobby", id:105, gradeLevel:4});
my_ds.addItem({name:"Carrie", id:106, gradeLevel:4});
my_ds.addItem({name:"Cathy", id:110, gradeLevel:4});
my_ds.addItem({name:"Mally", id:112, gradeLevel:3});
my_ds.addSort("name_id",["name", "id"]);
my_ds.setRange(["Bobby", 105],["Cathy", 110]);
while (my_ds.hasNext()) {
    trace(my_ds.name); // Bobby..Cathy
    my_ds.next();
}

See also

DataSet.addSort(), DataSet.hasNext(), DataSet.next(), DataSet.removeRange(), DataSet.removeSort()


Flash CS3