ArcGIS Explorer Component Help |
RowCollection..::.Sort Method |
RowCollection Class Example See Also |
Sorts the RowCollection by the specified columns.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public void Sort( string sortColumnNames ) |
Visual Basic (Declaration) |
---|
Public Sub Sort ( _ sortColumnNames As String _ ) |
Parameters
- sortColumnNames
- Type: System..::.String
A comma separated String of column names to sort by.
Remarks
A RowCollection is always sorted by the OBJECTID column by default, and the IsSorted property will be falseFalsefalsefalse (False in Visual Basic) until the Sort method is called.
The Sort method does not honor coded value domains or subtypes which have been applied to a Column and in these cases the sort will be applied to the actual values stored in the Table.
Examples
The code below sorts a RowCollection by two columns using the Sort method, checks to ensure that it is sorted
using the Sorted property, prints out all the sorted values, then removes the sort using the RemoveSort method.
CopyC#
{ //Open file geodatabase feature class Table mountainsTable = Table.OpenFileGeodatabaseTable(@"C:\Data\Scotland.gdb", "Mountains"); //Get all the rows RowCollection rows = mountainsTable.GetRows(); //Sort the RowCollection alphabetically by both the Type and by the Name Columns rows.Sort("Type,Name"); //Check to ensure that the RowCollection is now sorted if (rows.IsSorted == true) { //Iterate over all the rows, printing out the contents of each Row foreach (Row mtnRow in rows) { System.Diagnostics.Debug.Print(mtnRow.Values.ToString()); } //Now remove the sort - the rows will be sorted by OBJECTID rows.RemoveSort(); } }
CopyVB.NET
'Open file geodatabase feature class Dim mountainsTable As Table = Table.OpenFileGeodatabaseTable("C:\Data\Scotland.gdb", "Mountains") 'Get all the rows Dim rows As RowCollection = mountainsTable.GetRows() 'Sort the RowCollection alphabetically by both the Type and by the Name Columns rows.Sort("Type,Name") 'Check to ensure that the RowCollection is now sorted If rows.IsSorted = True Then 'Iterate over all the rows, printing out the contents of each Row For Each mtnRow As Row In rows System.Diagnostics.Debug.Print(mtnRow.Values.ToString()) Next 'Remove the sort - the rows will be sorted by OBJECTID rows.RemoveSort() End If