Represents a geodatabase subtypes entity which allows a table or feature class to be categorized if they share the same attributes.

Namespace:  ESRI.ArcGISExplorer.Data

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

Syntax

C#
public sealed class Subtypes
Visual Basic (Declaration)
Public NotInheritable Class Subtypes

Remarks

The class does not apply to shapefiles or dBase files and only applies to geodatabase tables and feature classes which have been subtyped. A Subtypes object can be returned from the Subtypes property, but it is sensible to check whether a Table has been subtyped first using the IsSubtyped property. A Table can only have a single subtyped Column (SubtypeColumnName) but the remaining columns may have multiple domains defined, one for each subtype.

Conceptually the Subtypes object is similar to a CodedValueDomain in that it consists of value/name pairs. Each value represents the actual value stored on disk in the Table, and the name represents a descriptive lookup for a value. To lookup at value for a particular description use the GetSubtypeValue method, or conversely to look up the description for a value use the GetSubtypeName method. Alternatively to return all the defined subtypes use the GetSubtypeValueNamePairs method which returns a SortedList consisting of value/name pairs.

Currently it is not possible to access the following information relating to subtypes: default values, validation rules, relationship rules, and split/merge policies.

For more information geodatabase subtypes, see An overview of subtypes in the ArcGIS Desktop web help.

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

Inheritance Hierarchy

System..::.Object

  ESRI.ArcGISExplorer.Data..::.Subtypes

See Also