Provides access to members that control the Field Checker.
Description
IFieldCheckerhas methods for validating fields collections and table names for a specific workspace. It's strongly recommended that this interface be used prior to two types of operations:
- Creating a new tabular dataset (such as a table or a feature class) from scratch
- Creating a new dataset based on an existing dataset, for example by using the feature data converter, or cloning an existing dataset's fields.
The main difference between these two cases is that while setting the ValidateWorkspace property is required to validate in either case, setting the InputWorkspace property is only required for the second case.
The Validate and ValidateField methods are responsible for verifying that field name, data types, and other parameters meet a minimum set of criteria that are required for the target workspace (set using the ValidateWorkspace property). ValidateTableName is used to verify that a table's name is not a reserved word, and that it does not start with or contain any invalid characters.
Members
Name | Description | |
---|---|---|
InputWorkspace | Input workspace of the fieldchecker. | |
Validate | Checks the validity of a list of field names. | |
ValidateDictionary | Fieldchecker dictionary. | |
ValidateField | Checks the validity of a field. | |
ValidateTableName | Checks the validity of a table name. | |
ValidateWorkspace | Workspace of the fieldchecker. |
IFieldChecker.InputWorkspace Property
Input workspace of the fieldchecker.
Public Property InputWorkspace As IWorkspace
public IWorkspace InputWorkspace {get; set;}
Description
The InputWorkspace property should be set when the IFieldChecker interface is used for creating a dataset that uses another dataset's fields. For example, when using the feature data converter to create a new dataset, or when cloning the fields of an existing dataset to use with a new dataset.
This property should be set to the source workspace - the workspace that contains the original dataset, not the newly created dataset.
IFieldChecker.Validate Method
Checks the validity of a list of field names.
Public Sub Validate ( _
ByVal inputField As IFields, _
ByRef error As IEnumFieldError, _
ByRef fixedFields As IFields _
)
public void Validate (
IFields inputField,
ref IEnumFieldError error,
ref IFields fixedFields
);
Description
Validatesets the IFieldsparameter to a set of fields valid for the target data format, and sets the IEnumFieldError to contain field error codes and associated field names. The error codes are stored as a esriFieldNameErrorType. If the IEnumFieldError is returned as Nothing then no errors were found.
IFieldChecker.ValidateDictionary Property
Fieldchecker dictionary.
Public Property ValidateDictionary As ISqlKeywordDictionary
public ISqlKeywordDictionary ValidateDictionary {get; set;}
Description
The ValidateDictionary method provides access to the dictionary used to verify that field and table names are reserved words in the target data source. A ISqlKeywordDictionary object can be used to search the dictionary used to validate a name when IFieldChecker::ValidateWorkspacehas been set. If a ValidateWorkspace has not been set a custom keyword dictionary can be built using ISqlKeywordDictionary. If the ValidateWorkspace has been set the dictionary can not be changed.
IFieldChecker.ValidateField Method
Checks the validity of a field.
Public Sub ValidateField ( _
ByVal FieldIndex As Integer, _
ByVal inputFields As IFields, _
ByRef error As IEnumFieldError, _
ByRef fixedFields As IFields _
)
public void ValidateField (
int FieldIndex,
IFields inputFields,
ref IEnumFieldError error,
ref IFields fixedFields
);
Description
ValidateFieldsvalidates a field selected using its FieldIndex value from the entered IFieldsobject. If the field is not valid IEnumFieldError and a IFields object is returned. The IEnumFieldError object will contain the field error code and the associated field name. The error codes are stored as a esriFieldNameErrorType. If the IEnumFieldError is returned as Nothing then no errors were found. The returned IFields object will include compliant field names.
IFieldChecker.ValidateTableName Method
Checks the validity of a table name.
Public Function ValidateTableName ( _
ByVal TableName As String, _
ByRef fixedName As String _
) As Integer
public int ValidateTableName (
string TableName,
ref string fixedName
);
Description
ValidateTableName verifies that a table name is valid for the target data format, and if needed, returns a compliant table name. This method returns a esriTableNameErrorType indicating the type of error. Table existence is not checked.
IFieldChecker.ValidateWorkspace Property
Workspace of the fieldchecker.
Public Property ValidateWorkspace As IWorkspace
public IWorkspace ValidateWorkspace {get; set;}
Description
Setting the ValidateWorkspace property is required prior to using any of this interface's Validate methods. This property should be set to the workspace where the dataset being validated is to be created.
Classes that implement IFieldChecker
Classes | Description |
---|---|
FieldChecker | Checks for errors in Field Name. |
Remarks
The logic used to determine if the OID field should be renamed to "ObjectID" can be classified with 4 cases.
Case1: Both the InputWorkspace and ValidateWorkspace are provided.
- The OID field is renamed to "ObjectID" if the InputWorkspace is of type esriFileSystemWorkspace and the ValidateWorkspace is a Geodatabase workspace (type esriLocalDatabaseWorkspace or esriRemoteDatabaseWorkspace).
Case2: Only the InputWorkspace is provided (the ValidateWorkspace has not been provided).
- The OID field is renamed to "ObjectID" if the InputWorkspace is of type esriFileSystemWorkspace.
Case3: Only the ValidateWorkspace is provided (the InputWorkspace has not been provided).
- The OID field is renamed to "ObjectID" if the ValidateWorkspace is a Geodatabase workspace.
Case4: Neither of the workspaces is provided
- The OID field is not renamed to "ObjectID"