Geographic Information Systems Asked by fortheloveofgis on February 14, 2021
I am using ArcMap 10.6 with Python 2.7.14 with ArcPy.
I want to sort a field named Seq_ID
in my attribute table by ascending order using ArcPy.
I believe I have to use arcpy.da.SearchCursor.
Here is my code snippet:
for row in arcpy.da.SearchCursor(points, fields, sql_clause=(None,'ORDER BY Seq_ID ASC'):
arcpy.AddMessage("")
else:
arcpy.AddMessage("")
However, after using this snippet above, my table is not sorted.
You are using a search cursor to READ your dataset and applying a sort whilst reading it, you are not editing it!
If you want to permanently sort rows in a table you need to use the SORT tool, this will create a new dataset sorted.
Answered by Hornbydd on February 14, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP