Gets the Subtypes associated with a Table.

Namespace:  ESRI.ArcGISExplorer.Data

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

Syntax

C#
public Subtypes Subtypes { get; }
Visual Basic (Declaration)
Public ReadOnly Property Subtypes As Subtypes

Field Value

A Subtypes object which represents different categories within the Table.

Examples

The code below demonstrates how to use the Subtypes class. A search is performed on a Buildings Table to find all the commercial buildings which are warehouses. The Table itself is subtyped, one of which is the Commercial subtype. Additionally all buildings are also classified using the Classification column, and each subtype uses a different Domain. An SQL expression must define the search criteria against values stored in the Table and not against subtype or domain descriptions. Consequently the Subtypes.GetSubtypeValue method and the Domain.GetValue method are used to find the actual values for the Commercial subtype and the Warehouse domain value respectively.
CopyC#
//Open the Buildings feature class
Table buildingsTable = Table.OpenFileGeodatabaseTable(@"C:\Data\CalgaryData2.gdb", "Buildings");

//Access the Subtypes 
Subtypes buildingSubtypes = buildingsTable.Columns.Subtypes;

//Lookup the stored value for the Commercial subtype
int commercialSubtypeValue = buildingSubtypes.GetSubtypeValue("Commercial");

//Return the domain applied to the Classification column for the Commercial subtype
CodedValueDomain commercialClassificationDomain = buildingsTable.Columns["Classification"].GetDomain("Commercial") as CodedValueDomain;

//Lookup the value for Warehouse in the Commercial domain
int warehouseCodedDomainValue = (int) commercialClassificationDomain.GetValue("Warehouse") ;

//Construct SQL clause to search for all commercial buildings which also are classified as warehouses
string commercialWarehouseWhereClause = string.Format("BLDG_CODE={0} AND Classification={1}", commercialSubtypeValue, warehouseCodedDomainValue);

//Execute query
RowCollection commercialWarehouseRows = buildingsTable.Search(new Filter(commercialWarehouseWhereClause));

//Prove that the search was successful by examining one of the results
if (commercialWarehouseRows.Count > 0)
{
  Row firstResultRow = commercialWarehouseRows.GetFirst();

  //Print the stored BLDG_CODE value
  System.Diagnostics.Debug.Print(firstResultRow.Values["BLDG_CODE"].ToString());        //Prints "6"
  //Print the name stored in the subtypes for this value
  System.Diagnostics.Debug.Print(firstResultRow.Values.GetCodedName("BLDG_CODE"));      //Prints "Commercial"

  //Print the stored Classification value
  System.Diagnostics.Debug.Print(firstResultRow.Values["Classification"].ToString());   //Prints "3"
  //Print the name stored in the 
  System.Diagnostics.Debug.Print(firstResultRow.Values.GetCodedName("Classification")); //Prints "Warehouse"
}
CopyVB.NET
'Open the Buildings feature class
Dim buildingsTable As Table = Table.OpenFileGeodatabaseTable("C:\Data\CalgaryData2.gdb", "Buildings")

'Access the Subtypes 
Dim buildingSubtypes As Subtypes = buildingsTable.Columns.Subtypes

'Lookup the stored value for the Commercial subtype
Dim commercialSubtypeValue As Integer = buildingSubtypes.GetSubtypeValue("Commercial")

'Return the domain applied to the Classification column for the Commercial subtype
Dim commercialClassificationDomain As CodedValueDomain = DirectCast(buildingsTable.Columns.Item("Classification").GetDomain("Commercial"), CodedValueDomain)

'Lookup the value for Warehouse in the Commercial domain
Dim warehouseCodedDomainValue As Integer = CType(commercialClassificationDomain.GetValue("Warehouse"), Integer)

'Construct SQL clause to search for all commercial buildings which also are classified as warehouses
Dim commercialWarehouseWhereClause As String = String.Format("BLDG_CODE={0} AND Classification={1}", commercialSubtypeValue, warehouseCodedDomainValue)

'Execute query
Dim commercialWarehouseRows As RowCollection = buildingsTable.Search(New Filter(commercialWarehouseWhereClause))

'Prove that the search was successful by examining one of the results
If commercialWarehouseRows.Count > 0 Then
  Dim firstResultRow As Row = commercialWarehouseRows.GetFirst()

  'Print the stored BLDG_CODE value
  System.Diagnostics.Debug.Print(firstResultRow.Values.Item("BLDG_CODE").ToString())        'Prints "6"
  'Print the name stored in the subtypes for this value
  System.Diagnostics.Debug.Print(firstResultRow.Values.GetCodedName("BLDG_CODE"))      'Prints "Commercial"


  'Print the stored Classification value
  System.Diagnostics.Debug.Print(firstResultRow.Values.Item("Classification").ToString())   'Prints "3"
  'Print the name stored in the 
  System.Diagnostics.Debug.Print(firstResultRow.Values.GetCodedName("Classification")) 'Prints "Warehouse"
End If

See Also