AnsweredAssumed Answered

Make CalculatedField with join between feature class and table from gdb

Question asked by lodecombe_DirEtudes on Jun 26, 2017
Latest reply on Jun 26, 2017 by Dan_Patterson



I tried to make calculatedfield on a field of the feature classe that was joined with a table but does not success.


Can anyone help me to write correctly the expression.


Thank you very much



# Set environment settings
arcpy.env.workspace = r"C:\Users\Folder"
arcpy.env.qualifiedFieldNames = False

# Set local variables
inFeatures = r"C:\Users\Folder\Name.gdb\FC"
layerName = "FC"
joinTable = r"C:\Users\Folder\Name.gdb\Table_iris_france"
tableName= "table_iris"
joinField = "ID"
joinField2 = "CODE_IRIS"

# Create a feature layer from the vegtype featureclass
arcpy.MakeFeatureLayer_management (inFeatures, layerName)

# Make a table view from the table
arcpy.MakeTableView_management(joinTable, tableName)

# Join the feature layer to a table
arcpy.AddJoin_management(layerName, joinField, joinTable, joinField2)

# Process: Calculer un champ
arcpy.CalculateField_management(layerName, "Pop_COURANT", "!"+tableName+".POP_COURANT2!", "PYTHON")