Provides access to members that return and modify subtype information.
Description
ISubtypesinterface is implemented by the ObjectClass class and is used to maintain information about subtypes for the object class. Subtypes can be removed, added, and retrieved using this interface. Default subtypes and subtypecodes can be set for the object class here as well.
When To Use
The ISubtypes interface is the main interface for managing the subtypes, default values and attribute domains of an object class. For example, use the ISubtypes interface to create new subtypes, delete subtypes and assign an attribute domain for a particular field of a subtype. ISubtypes is an interface implemented by the ObjectClass class.
Members
Name | Description | |
---|---|---|
AddSubtype | Adds the subtype to the set of associated subtypes. | |
DefaultSubtypeCode | The default subtype associated with the class. | |
DefaultValue | The default value for the associated attribute. | |
DeleteSubtype | Deletes the subtype from the set of associated subtypes. | |
Domain | The domain given the subtype and field. | |
HasSubtype | Indicates if the table has subtypes. | |
SubtypeFieldIndex | The subtype field index. | |
SubtypeFieldName | The subtype field name. | |
SubtypeName | The subtype name. | |
Subtypes | The subtypes associated with the class. |
ISubtypes.AddSubtype Method
Adds the subtype to the set of associated subtypes.
Public Sub AddSubtype ( _
ByVal SubtypeCode As Integer, _
ByVal SubtypeName As String _
)
public void AddSubtype (
int SubtypeCode,
string SubtypeName
);
Description
AddSubtypeadds the subtype to the set of subtypes for the given object class with the subtype code and subtype name given.
Functional License Check
If your application/site is not appropriately licensed, AddSubtype can return an error of FDO_E_NO_SCHEMA_LICENSE.
Remarks
AddSubtypewill create a new subtype for the associated object class. This method requires a subtype code as a Long and a subtype name as a String. Before adding subtypes, use the ISubtypes::SubtypeFieldName property to set the subtypes field.
Once created, you can use the ISubtypes::DefaultValue property to set default values for this subtypes fields, and the ISubtypes::Domain property to assign domains to fields for the subtype.
ISubtypes.DefaultSubtypeCode Property
The default subtype associated with the class.
Public Property DefaultSubtypeCode As Integer
public int DefaultSubtypeCode {get; set;}
Description
DefaultSubtypeCodeproperty sets and returns the default subtype code for the given object class.
Functional License Check
If your application/site is not appropriately licensed, DefaultSubtypeCode can return an error of FDO_E_NO_SCHEMA_LICENSE.
Remarks
This property sets or returns the value of the default subtype code for the associated class.
ISubtypes.DefaultValue Property
The default value for the associated attribute.
Public Function get_DefaultValue ( _
ByVal SubtypeCode As Integer, _
ByVal FieldName As String _
) As Object
Public Sub set_DefaultValue ( _
ByVal SubtypeCode As Integer, _
ByVal FieldName As String, _
ByVal Value As Object _
)
public object get_DefaultValue (
int SubtypeCode,
string FieldName
);
public void set_DefaultValue (
int SubtypeCode,
string FieldName,
object Value
);
Description
DefaultValue property returns the default value for the given subtype.
Functional License Check
If your application/site is not appropriately licensed, DefaultValue can return an error of FDO_E_NO_SCHEMA_LICENSE.
Remarks
This property return the default value for a particular field associated with a subtype. It requires the subtype code as a Long and the field name as a String . You can use the IField::Type property to determine the type of field that you are passing into the function so you will know what data type is being returned.
ISubtypes.DeleteSubtype Method
Deletes the subtype from the set of associated subtypes.
Public Sub DeleteSubtype ( _
ByVal SubtypeCode As Integer _
)
public void DeleteSubtype (
int SubtypeCode
);
Description
DeleteSubtypetakes the subtype code parameter to remove the subtype from the set of subtypes of the given object class.
Errors Returned
FDO_E_SUBTYPE_CODE_HAS_ASSOCIATED_TOPOLOGY_RULE: Cannot delete a subtype code that is associated with a topology rule.
FDO_E_SUBTYPE_IN_USE_CANNOT_DELETE:Cannot delete a subtype code that is used to define connectivity for a feature class in a network dataset.
Functional License Check
If your application/site is not appropriately licensed, DeleteSubtype can return an error of FDO_E_NO_SCHEMA_LICENSE.
Remarks
DeleteSubtype will delete a subtype for the associated object class. Calling DeleteSubtype will also remove any reference to that subtype in the geodatabase.
ISubtypes.Domain Property
The domain given the subtype and field.
Public Function get_Domain ( _
ByVal SubtypeCode As Integer, _
ByVal FieldName As String _
) As IDomain
Public Sub set_Domain ( _
ByVal SubtypeCode As Integer, _
ByVal FieldName As String, _
ByVal Domain As IDomain _
)
public IDomain get_Domain (
int SubtypeCode,
string FieldName
);
public void set_Domain (
int SubtypeCode,
string FieldName,
IDomain Domain
);
Description
The Domainproperty returns or sets the domain given the subtype code and the fieldname of the subtype.
Remarks
This property returns or sets an IDomain object associated with a particular subtype code and field. The subtype code is required as a Long and field name as a String.
ISubtypes.HasSubtype Property
Indicates if the table has subtypes.
Public ReadOnly Property HasSubtype As Boolean
public bool HasSubtype {get;}
Description
HasSubtypeproperty returns a boolean value whether the given object class has subypes or not.
Remarks
This property returns a boolean value indicating if the object class has subtypes defined. If there are no subtypes defined, it returns FALSE , if there are subypes defined it returns TRUE.
ISubtypes.SubtypeFieldIndex Property
The subtype field index.
Public ReadOnly Property SubtypeFieldIndex As Integer
public int SubtypeFieldIndex {get;}
Description
SubtypeFieldIndexproperty returns the index of the subtype field.
Remarks
This property returns the index of the field in the object class which stores the subtype codes. The field index is returned as a Long.
ISubtypes.SubtypeFieldName Property
The subtype field name.
Public Property SubtypeFieldName As String
public string SubtypeFieldName {get; set;}
Errors Returned
FDO_E_SUBTYPE_CODE_HAS_ASSOCIATED_TOPOLOGY_RULE: Resetting the Subtype field which contains a subtype code that is associated with a topology rule will raise an error.
Remarks
The SubtypeFieldName property is used to either set or return string value for the field that contains the subtypes for this object class. To assign the subtype field, set SubtypeFieldName equal to the name of the field:
ISubtypes.SubtypeName Property
The subtype name.
Public Function get_SubtypeName ( _
ByVal SubtypeCode As Integer _
) As String
public string get_SubtypeName (
int SubtypeCode
);
Description
SubtypeNameproperty returns the subtype name for the subtype referred to by the parameter subtypecode.
Remarks
This property returns the name of a subtype for a given subtype code for the associated object class. The subtype code is required as a Long and returns the name of the subtype as a String.
ISubtypes.Subtypes Property
The subtypes associated with the class.
Public ReadOnly Property Subtypes As IEnumSubtype
public IEnumSubtype Subtypes {get;}
Description
Subtypesreturns a IEnumSubtype populated with all of the subtypes for the given object class.
Remarks
Every ObjectClass has a default subtype code. If the user has not explicitly specified a default subtype or a subtype field, then DefaultSubtypeCodewill return a subtype code of zero. Additionally, you can query the HasSubtypeproperty; a value of Falseindicates an absence of a default subtype code, Trueindicates the presence of a default subtype code.
If the client instead asks for the enumeration of subtypes associated with an ObjectClass and no subtype has been previously added to the ObjectClass, then the enumerator will contain a single entry with a code of zero. The subtype field index value will be �1 if a default subtype has not been previously specified. Subtypes may only be short or long integers (esriFieldTypeSmallIntegeror esriFieldTypeInteger). When setting the default subtype code, if one already exists, then it will be deleted. A subtype field must have been specified prior to setting the subtype code value.
Every type of field, except for esriFieldTypeShape, may have a default value. When setting the default value (which my be assigned on a subtype basis), it will be checked against the field�s associated Domain (if one exists) for validity.
This property returns all of the subtypes for the associated object class. Subtypes returns an IEnumSubtype enumeration which you can loop through to get all of the subtypes.
Classes that implement ISubtypes
Classes | Description |
---|---|
FeatureClass | Esri Feature Class object. |
ObjectClass | Esri Object Class object. |
XYEventSource | XY event source object. |