Calculate value in a joined table

2258
3
Jump to solution
11-27-2013 11:12 PM
AlbertoLaurenti
New Contributor III
Hi,
I've to calculate a field based on another field in a joined table, but an error occurs:

"Parameters are not valid.
ERROR 000728: Field !Table_A.field_A! does not exist within table"


import arcpy from arcpy import env env.workspace = "C:/TMP/BASELINE.gdb" Table_A = "dist" Table_B= "matrix" arcpy.AddJoin_management(Table_A, "id_grid", Table_B, "id_matrix") arcpy.CalculateField_management(Table_A, "!" + Table_A + ".field_A!", "!" + Table_B + ".field_B!","PYTHON")


Both tables are in the BASELINE.gdb. The Join occurs without any problem.

Please, any help appreciated.
Thanks in advance
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
FabianBlau
Occasional Contributor II
Too much bangs I guess:

arcpy.CalculateField_management(Table_A, Table_A + ".field_A", "!" + Table_B + ".field_B!","PYTHON")

View solution in original post

0 Kudos
3 Replies
AlbertoLaurenti
New Contributor III
I forgot to say that, of course, "field_A" exists in "Table_A" and "field_B" exists in "Table_B".
Last but not least, if I run the same calculation in Arcmap, using Field Calculator, no error occur.

Thanks
0 Kudos
FabianBlau
Occasional Contributor II
Too much bangs I guess:

arcpy.CalculateField_management(Table_A, Table_A + ".field_A", "!" + Table_B + ".field_B!","PYTHON")
0 Kudos
AlbertoLaurenti
New Contributor III
Ooops, you're right!!
Now it works perfectly. Thank you
0 Kudos