ParseFieldName on layer with joined table

Discussion created by heyserj on Apr 30, 2012
Latest reply on Apr 30, 2012 by heyserj

I'm having problems getting ParseFieldName to work the way I think it should work. It seems like it should be straightforward, so I suspect I'm either expecting it to do something it wasn't meant to do, or there is just a problem with my code.

I am expecting that when looping through the fields of a featureclass that has a joined table that ParseFieldName will separate out the joined table name and the field name. For example if the joined table is named draindst_draindst and it contains a field called description that ParseFieldName will return a list that looks like (null), (null), draindst_draindst, Description. It is not, it returns (null), (null), (null), draindst_draindst_Description

Here is the code:

env.qualifiedFieldNames =True

fc = r'c:\usr_proj\Heyserj\python_start\xxDW18.gdb\Draindst'
tb = r'c:\usr_proj\Heyserj\python_start\xxDW18.gdb\draindst_draindst'

fc_layer = arcpy.MakeFeatureLayer_management(fc, "layer")
arcpy.AddJoin_management( fc_layer, r'draindst', tb, 'draindst', "KEEP_ALL")
env.workspace = os.path.dirname(fc)
fieldmappings = arcpy.FieldMappings()
# Parse the feature class name into its components
for feat_field in fieldmappings.fields:
[INDENT]fullName = arcpy.ParseFieldName(feat_field.name, os.path.dirname(fc))
print str(fullName)[/INDENT]

Here is the output:

(null), (null), (null), Draindst_DrainDst
(null), (null), (null), Draindst_Shape_Length
(null), (null), (null), Draindst_Shape_Area
(null), (null), (null), draindst_draindst_OBJECTID
(null), (null), (null), draindst_draindst_DrainDst
(null), (null), (null), draindst_draindst_Description
(null), (null), (null), draindst_draindst_Symbol
(null), (null), (null), draindst_draindst_Type

Many thanks in advance,