ArcGIS Explorer Component Help |
ColumnCollection..::.FindColumnByAliasName Method |
ColumnCollection Class Example See Also |
Returns the index position of the Column, given the specified alias name.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public int FindColumnByAliasName( string columnAliasName ) |
Visual Basic (Declaration) |
---|
Public Function FindColumnByAliasName ( _ columnAliasName As String _ ) As Integer |
Parameters
- columnAliasName
- Type: System..::.String
The alias name of the Column.
Return Value
An integer representing index position of the Column. If the column cannot be found a value of -1 will be returned.Examples
The code below shows different approaches to finding the index position of a column within a Table
and how to return Column objects. The second example uses the FindColumnByAliasName method to return the index of the
column which has the "Name" alias.
CopyC#
//Open a file geodatabase feature class called mountains Table mountainsTable = Table.OpenFileGeodatabaseTable(@"C:\Data\Scotland.gdb", "mountains"); //Example 1 - return the index position of the Name column int nameColPosition = mountainsTable.Columns.FindColumn("Name"); System.Diagnostics.Debug.Print(nameColPosition.ToString()); //Prints "2" //Get the Name column Column nameColumn = mountainsTable.Columns[nameColPosition]; //Example 2 - return the index position of the Name column using the column alias name nameColPosition = mountainsTable.Columns.FindColumnByAliasName("Name"); System.Diagnostics.Debug.Print(nameColPosition.ToString()); //Prints "2" //Get the Name column nameColumn = mountainsTable.Columns[nameColPosition]; //Example 3 - return the Name column directly by column name nameColumn = mountainsTable.Columns["Name"];
CopyVB.NET
'Open a file geodatabase feature class called mountains Dim mountainsTable As Table = Table.OpenFileGeodatabaseTable("C:\Data\Scotland.gdb", "mountains") 'Example 1 - return the index position of the Name column Dim nameColPosition As Integer = mountainsTable.Columns.FindColumn("Name") System.Diagnostics.Debug.Print(nameColPosition.ToString()) 'Prints "2" 'Get the name column using index Dim nameColumn As Column = mountainsTable.Columns.Item(nameColPosition) 'Example 2 - return the index position of the Name column using the column alias name nameColPosition = mountainsTable.Columns.FindColumnByAliasName("Mountain Name") System.Diagnostics.Debug.Print(nameColPosition.ToString()) 'Prints "2" 'Get the name column using index nameColumn = mountainsTable.Columns.Item(nameColPosition) 'Example 3 - return the Name column directly by column name nameColumn = mountainsTable.Columns.Item("Name")