Writing Subtypes and Domains
When writing subtypes, the user has two choices: use the integer code or use the code’s description. If the integer code is used, then the code is set on an attribute of the same name as the subtype field. For example, if the subtype field is called road_type, then an attribute called road_type must be populated on the FME feature with the appropriate integer code. If the code’s description is used instead, then the description must be supplied on a special attribute called geodb_subtype_name. The code corresponding to the description will then be looked up and, once found, will be inserted onto the subtype field.
Similarly, when writing domains, either the integer code may be specified or the code’s description. If the integer code is used, then the code is set on an attribute of the same name as the domain field. For example, if the domain field is called road_type, then an attribute called road_type must be populated on the FME feature with the appropriate integer code. If the code’s description is used instead, then the description must be supplied on an attribute called road_type_resolved. The code corresponding to the description will be looked up and inserted onto the domain field.
The Geodatabase writer goes through the following steps when writing a subtype:
- Retrieve the subtype (code) attribute from the feature.
- If the attribute is found but does not contain a valid subtype code (i.e. the code is not one of the possible subtypes or the code is not an integer) then an error is returned and the feature is not written.
- If the attribute was not supplied on the feature, or was supplied but set to the empty string (i.e. it was set to ""), then go to step 2.
- Retrieve the geodb_subtype_name attribute.
- If this attribute is found and not set to the empty string, then the writer attempts to look up the code corresponding to the supplied description. If no code is found, then the description used is not valid, resulting in an error being returned and the feature not being written.
- If this attribute is not supplied or was supplied but set to the empty string (i.e., set to ""), and we’re inserting a new feature (not updating an existing feature), then the default code gets written to the subtype field.