I am ArcGIS 10 user and I want to create ArcPy script for simple concatenate row values like this tool Concatenate Row Value that works with ArcGIS 10.
I have three fields in my shapefile
Here the image from my shapefile
.dbf after sort by id.
If you see the image you can see the id not have unique values.
I want to create the layer with unique id values but I don't want to loose some values from field2 (is text). For field2 I need to use for next conditions.
In Excel if I use some condition like this:
Then I take new field to like this:
That works in Excel, I want to do with Python or ArcPy or some tool from ArcGIS.
In QGIS, it is easy for me to do with this plugin that does
dissolve with stats.
I try to follow this code:
updateFields = ["id", "field2", "field3"] with arcpy.UpdateCursor("featurelayer", updateFields) as cursor: for row in cursor: if row+1 == row and row+1==row: row = row elif row+1 == row and row+1!=row: row = row elif row+1 == row and row+1!=row: row = row+','+row+1 cursor.updateRow(row)
That looks correct but any time to try to run it I take this error:
Cursor AttributeError: __exit__
How do I fix the problem?