ArcGIS Explorer Component Help |
Subtypes..::.Count Property |
Subtypes Class Example See Also |
Gets the count of the number of subtypes defined in a Table.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
Field Value
The number of subtypes defined in the SubtypeColumnName.Examples
The code below demonstrates how to access the subtypes in a Table. The Table.IsSubtyped property is used
to check that the Table is subtyped and the ColumnCollection.Subtypes property returns the Subtypes object.
The Count property is used to ensure that the loop iterates the correct number of times when returning
the subtype value/name pairs.
CopyC#
//Open the Buildings feature class Table buildings = Table.OpenFileGeodatabaseTable(@"C:\Data\CalgaryData2.gdb", "Buildings"); //Check that the Table is subtyped if (buildings.IsSubtyped) { //Return the Subtypes from the ColumnCollection Subtypes subs = buildings.Columns.Subtypes; //Print the name of the Column which manages the subtypes System.Diagnostics.Debug.Print(subs.SubtypeColumnName); //Prints "BLDG_CODE" //Return a sorted list (value/description name) containing all the subtypes SortedList<int, string> subtypesList = subs.GetSubtypeValueNamePairs(); //Print out the contents of the subtypes for (int i = 0; i < subs.Count-1; i++) { //Each Key is the subtype value System.Diagnostics.Debug.Print(subtypesList.Keys[i].ToString()); //Each Value is the subtype descriptive name System.Diagnostics.Debug.Print(subtypesList.Values[i].ToString()); } }
CopyVB.NET
'Open the Buildings feature class Dim buildings As Table = Table.OpenFileGeodatabaseTable("C:\Data\CalgaryData2.gdb", "Buildings") 'Check that the Table is subtyped If (buildings.IsSubtyped) Then 'Return the Subtypes from the ColumnCollection Dim subs As Subtypes = buildings.Columns.Subtypes 'Print the name of the Column which manages the subtypes System.Diagnostics.Debug.Print(subs.SubtypeColumnName) 'Prints "BLDG_CODE" 'Return a sorted list (value/description name) containing all the subtypes Dim subtypesList As SortedList(Of Integer, String) = subs.GetSubtypeValueNamePairs() 'Print out the contents of the subtypes For i As Integer = 0 To subs.Count - 1 'Each Key is the subtype value System.Diagnostics.Debug.Print(subtypesList.Keys.Item(i).ToString()) 'Each Value is the subtype descriptive name System.Diagnostics.Debug.Print(subtypesList.Values.Item(i).ToString()) Next End If