AnsweredAssumed Answered

Arcpy MakeFeatureLayer_management Lyr name

Question asked by Geojorge on May 24, 2017
Latest reply on May 24, 2017 by Geojorge

I'm a complete noob at arcpy. 

I must do a college paper using arcpy. It’s a step by step thing and it takes much longer than expected J

I’ve got a question regarding the add join tool. From what I could find online, I need to make a feature layer to get the join working. I’ve achieved this, but always with a problem: I lose my feature name when converting it to a layer. Each new feature is named after the «joinFeaturesLyr» (adding a number) and not using the features in the database names. Is there a way to solve this? It’s been killing me for the las two days.

This is the part of the script I mentioned. I tried to use the for

 

arcpy.env.overwriteOutput = True
arcpy.env.workspace = tmp_GDB    #It's a gdb called tmp!
#outputFcList = arcpy.ListFeatureClasses() 
#print outputFcList

for joinFeatures in arcpy.ListFeatureClasses():
    arcpy.MakeFeatureLayer_management(joinFeatures,
"joinFeaturesLyr")

   
print 'Executing'

   
try:
        arcpy.AddJoin_management(
in_layer_or_view="joinFeaturesLyr", in_field="MsLink_ODBC", join_table=catalogo, join_field="ligacao")
   
except Exception as err:
       
print(err.args[0])

   
print ‘Exporting'
   
try:
        arcpy.FeatureClassToGeodatabase_conversion(
"joinFeaturesLyr", tmp_GDB)
   
except:
       
#arcpy.AddError('Script Error')
       
print arcpy.GetMessages()
 

 

Thank you!

Outcomes