Tools that honor the Qualified Field Names environment use this setting to distinguish between qualified or unqualified field names. Qualified field names are the names of fields in a feature class or table that have the name of the origin feature class or table appended onto the field name. This setting is relevant when working with joined data.
- The default qualified output table field naming structure is tableName.fieldName. When unqualified, the fields in the output table or feature class will always be named with the format fieldName.
- In instances where qualified field names may exceed the allowed field name width, set the environment to UNQUALIFIED, for example, when joining shapefiles. Shapefile fields are truncated at eight characters.
When field mappings are included in a tool's parameters, as they are in many tools in the Conversion toolbox, field names are automatically UNQUALIFIED, so it is not necessary to set this environment.
- Checked—The output field name includes the table name. This is the default.
- Unchecked—The output field name will not include the table name.
arcpy.env.qualifiedFieldNames = qualified_field_names
The output field name includes the table name. This can also be set using the QUALIFIED keyword. This is the default.
The output field name will not include the table name. This can also be set using the UNQUALIFIED keyword.
# Name: addjoin.py # Purpose: Join a table to a featureclass and have the output # unqualified # Import system modules import arcpy import sys try: # Set environment settings arcpy.env.workspace = "C:/data" arcpy.env.qualifiedFieldNames = False # Set local variables inFeatures = "Habitat_Analysis.gdb/vegtype" layerName = "veg_layer" joinTable = "vegtable.dbf" joinField = "HOLLAND95" expression = "vegtable.HABITAT = 1" outFeature = "Habitat_Analysis.gdb/vegjoin" # Create a feature layer from the vegtype featureclass arcpy.MakeFeatureLayer_management(inFeatures, layerName) # Join the feature layer to a table arcpy.AddJoin_management(layerName, joinField, joinTable, joinField) # Copy the layer to a new permanent feature class # Output fields are unqualified, so the field name will # not contain the origin table arcpy.CopyFeatures_management(layerName, outFeature) except Exception: e = sys.exc_info() print(e.args)