User Guide
DataSet component (Flash Professional only) 349
Parameters
sortName
A string that contains the name of the sort to use.
order An integer value that indicates the sort order for the sort; the value must be
DataSetIterator.Ascending or DataSetIterator.Descending.
Returns
Nothing.
Description
Method; switches the sort for the current iterator to the one specified by sortName, if it exists. If
the specified sort does not exist, a
DataSetError exception is thrown.
To create a sort, use
DataSet.applyUpdates().
Example
This code uses DataSet.hasSort() to determine if a sort named "customer" exists. If it does,
the code calls
DataSet.useSort() to make "customer" the current sort. Otherwise, the code
creates a sort by that name using
DataSet.addSort().
if(myDataSet.hasSort("customer")) {
myDataSet.useSort("customer");
} else {
myDataSet.addSort("customer", ["customer"], DataSetIterator.Descending);
}
See also
DataSet.applyUpdates()
, DataSet.hasSort()