Gets the coded domain value for the column specified by index position. The method is relevant when working with data stored in a geodatabase and specifically for tables or feature classes using domains.

Namespace:  ESRI.ArcGISExplorer.Data

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public string GetCodedName(
	int index
)
Visual Basic (Declaration)
Public Function GetCodedName ( _
	index As Integer _
) As String

Parameters

index
Type: System..::.Int32

The index position of the Column.

Return Value

The name stored in the coded value domain associated with the column value at the specified index position.

Examples

The code below provides three examples of how to access data stored in a Row using the RowValueCollection. Example 2 uses the GetCodedName method to look up the coded value for a column using its index position.
CopyC#
//Open Montgomery file geodatabase
Geodatabase gdb = new Geodatabase(@"C:\Data\Montgomery.gdb");

//Open the parcels featureclass
Table parcels = gdb.OpenTable("parcels");

//Get a single parcel
Row row = parcels.GetRow(3704);

//Get the RowValueCollection for this Row
RowValueCollection values = row.Values;

//Example 1 - iterate over the RowValueCollection using a 'for each' loop printing out the column values.
foreach (object val in values)
{
  System.Diagnostics.Debug.Print(val.ToString());
}

//Example 2- iterate over the RowValueCollection using a 'for' loop printing out the column names
//and their associated values. The coded value will be printed for any columns which have an
//associated coded value domain defined.
for (int i = 0; i < values.ColumnCount; i++)
{
  //Get the name of the column
  string columnName = values.Columns[i].Name;

  string rowValue = string.Empty;

  if ((values.Columns[i].HasDomain) && (values.Columns[i].GetDomain().Type == DomainType.CodedValue))
  {
    //Get the coded value if a coded value domain is defined against this column
    rowValue = values.GetCodedName(i);
  }
  else
  {
    //Get the actual value stored in the table
    rowValue = values[i].ToString();
  }

  //Print the column name and the value for every column in this Row
  System.Diagnostics.Debug.Print(string.Format("Column Name: {0}, Row Value: {1}", columnName, rowValue));
}

//Example 3 - Get values for individual columns

//Get the unique id value maintained by the geodatabase.
int uniqueID = (int)values[parcels.Columns.ObjectIDColumnName];
System.Diagnostics.Debug.Print(uniqueID.ToString());

//Get the actual value stored in the table for the 'Zoning_S' column
string zoningValue = (string)values["ZONING_S"];
System.Diagnostics.Debug.Print(zoningValue);  //Prints "R"

//Get the coded value stored in the domain associated with the 'Zoning_S' column
string zoningCodedDomainValue = (string)values.GetCodedName("ZONING_S");
System.Diagnostics.Debug.Print(zoningCodedDomainValue);   //Prints "Residential"
CopyVB.NET
'Open Montgomery file geodatabase
Dim gdb As Geodatabase = New Geodatabase("C:\Data\Montgomery.gdb")

'Open the parcels featureclass
Dim parcels As Table = gdb.OpenTable("parcels")

'Get a single parcel
Dim r As Row = parcels.GetRow(3704)

'Get the RowValueCollection for this Row
Dim values As RowValueCollection = r.Values

'Example 1 - iterate over the RowValueCollection using a 'for each' loop printing out the column values.
For Each val As Object In values
  System.Diagnostics.Debug.Print(val.ToString())
Next

'Example 2 - iterate over the RowValueCollection using a 'for' loop printing out the column names
'and their associated values. The coded value will be printed for any columns which have an
'associated coded value domain defined.
For i As Integer = 0 To values.ColumnCount - 1
  'Get the name of the column
  Dim columnName As String = values.Columns.Item(i).Name
  Dim rowValue As String = String.Empty

  If ((values.Columns.Item(i).HasDomain) And (values.Columns.Item(i).GetDomain().Type = DomainType.CodedValue)) Then

    'Get the coded value if a coded value domain is defined against this column
    rowValue = values.GetCodedName(i)

  Else
    'Get the actual value stored in the table
    rowValue = values.Item(i).ToString()
  End If

  'Print the column name and the value for every column in this Row
  System.Diagnostics.Debug.Print(String.Format("Column Name: {0}, Row Value: {1}", columnName, rowValue))

Next

'Example 3 - Get values for individual columns


'Get the unique id value maintained by the geodatabase.
Dim uniqueID As Integer = DirectCast(values.Item(parcels.Columns.ObjectIDColumnName), Integer)
System.Diagnostics.Debug.Print(uniqueID.ToString())

'Get the actual value stored in the table for the 'Zoning_S' column
Dim zoningValue As String = DirectCast(values.Item("ZONING_S"), String)
System.Diagnostics.Debug.Print(zoningValue)  'Prints "R"


'Get the coded value stored in the domain associated with the 'Zoning_S' column
Dim zoningCodedDomainValue As String = DirectCast(values.GetCodedName("ZONING_S"), String)
System.Diagnostics.Debug.Print(zoningCodedDomainValue)   'Prints "Residential"

See Also