khan18

add attributes to newly created shapefile from existing shapefile using arcpy

Discussion created by khan18 on Mar 11, 2013
Latest reply on Mar 11, 2013 by khan18
I have a paretn layer with multiple table entries and want to select first row and paste it into another (target layer) table. Parent table will change after each run of geoprocessing and I want to get the first row every time and paste it to target layer. Both tables have different number of fields and I want to have FID, Shape, and id fields in target layer. Following is piece of code that I am trying to work to accomplish this:

Import arcpy
ofc = "C:/outFC.shp"
ifc = "C:/inFC.shp"
fields = arcpy.ListFields(ifc,"*","ALL")
for f in fields:
    shape = f.Shape
    query = '"Shape" = \'' + str(shape) + '\''
    cur = arcpy.UpdateCursor(ofc,query)

del f, fields

Outcomes