I need sequential numbers(1,2,3...) for the selected features in the particular feild in attribute table, how to do it?
Solved! Go to Solution.
You may have luck using this here:
https://support.esri.com/en-us/knowledge-base/how-to-sort-and-create-a-sequentially-ordered-id-field...
Cody
What kind of geodatabase?
If it's a mobile or enterprise geodatabase, it could be done in a SQL database view. And then you could join from the FC to the view and use the field calculator to populate the ID field in the FC.
Mobile geodatabase (SQLite):
select c.*, row_number() over (order by population_2021 desc) as sorted_id from cities c
(File geodatabases don't have a row_number() function.)
If it's a file geodatabase (or any kind of geodatabase), you could use the Sort geoprocessing tool in conjunction with a join.
Like this:
In hindsight, I could have joined on Objectid=OrigFID, instead of using my temp_unique_id field.
ArcGIS Pro 3.2.1
Check out this arcticle by ESRI Support, It's for ArcMap but it still works in pro! You can modify the python code to fit your needs :).
https://support.esri.com/en-us/knowledge-base/how-to-create-sequential-numbers-in-a-field-in-arcmap-...
If you want something more simple, calculate your field equal to the ObjectID
You may have luck using this here:
https://support.esri.com/en-us/knowledge-base/how-to-sort-and-create-a-sequentially-ordered-id-field...
Cody
this sequential number() is working based on OBJECTID, but I need the numbers without using OBJECTID in just sequential manner how my order is on the attribute table?
What kind of geodatabase?
If it's a mobile or enterprise geodatabase, it could be done in a SQL database view. And then you could join from the FC to the view and use the field calculator to populate the ID field in the FC.
Mobile geodatabase (SQLite):
select c.*, row_number() over (order by population_2021 desc) as sorted_id from cities c
(File geodatabases don't have a row_number() function.)
If it's a file geodatabase (or any kind of geodatabase), you could use the Sort geoprocessing tool in conjunction with a join.
Like this:
In hindsight, I could have joined on Objectid=OrigFID, instead of using my temp_unique_id field.
ArcGIS Pro 3.2.1