AnsweredAssumed Answered

CalculateField based on attribute in another layer

Question asked by soldous on Feb 23, 2016
Latest reply on Feb 24, 2016 by xander_bakker

Hello

I have list of layers from mxd save in a variable lyrs. I want to copy every layer to file gdb so I use for loop.  I need to preserve original OBJECTID in the new layers so I add a new field originOBJID into new layers. Is there any option/expression how to calculate field in new layer based on attribute OBJECTID from original layer (lyr in the for loop)??

 

mxd=arcpy.mapping.MapDocument("path")

lyrs=arcpy.mapping.ListLayers(mxd)

for lyr in lyrs:

    layr=arcpy.FeatureClassToFeatureClass_conversion(lyr,in_gdb,lyr.name)

    arcpy.AddField_management(layr,"originOBJID","LONG")

    arcpy.CalculateField_management(layr,"originOBJID","???")

 

 

Thanks a lot for help!

Outcomes