If you are familiar with java(script) then you should be able to use python without too much trouble.
The basic concept would be to create an update cursor, iterate over the rows and assign a value to your field, incrementing each time.
Here's a very minimal example, contained in a python toolbox. You could certainly do more spiffy things, like updating the progress bar or adding the field within the script.
Just past this into a text file with an extension of '.pyt'. That will show up as a toolbox in your GIS catalog that has a single tool called Calculate Ascending Values.
import arcpy
class Toolbox(object):
def __init__(self):
"""A python Toolbox to hold the CalcAscendingValues tool"""
self.label = "Python Tool Demo"
self.alias = ""
# List of tool classes associated with this toolbox
self.tools = [CalcAscendingValues]
class CalcAscendingValues(object):
def __init__(self):
"""Assigns ascending integer values to the field specified, starting at 1."""
self.label = "Calculate Ascending Values"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
pInputTable = arcpy.Parameter()
pInputTable.displayName = 'Input Table'
pInputTable.name = 'input_table'
pInputTable.datatype = 'Table View'
pInputTable.parameterType = 'Required'
pInputTable.direction = 'Input'
pSortField = arcpy.Parameter()
pSortField.displayName = 'Sort Field'
pSortField.name = 'sort_field'
pSortField.datatype = 'Field'
pSortField.parameterType = 'Required'
pSortField.direction = 'Input'
pSortField.parameterDependencies = [pInputTable.name]
pValueField = arcpy.Parameter()
pValueField.displayName = 'Value Field'
pValueField.name = 'value_field'
pValueField.datatype = 'Field'
pValueField.parameterType = 'Required'
pValueField.direction = 'Input'
pValueField.filter.list = ['LONG','SHORT']
pValueField.parameterDependencies = [pInputTable.name]
pOutputTable = arcpy.Parameter()
pOutputTable.displayName = 'Output Table'
pOutputTable.name = 'output_table'
pOutputTable.datatype = 'Table'
pOutputTable.parameterType = 'Derived'
pOutputTable.direction = 'Output'
pOutputTable.parameterDependencies = [pInputTable.name]
pOutputTable.schema.fieldsRule = 'AllNoFIDs'
params = [pInputTable, pSortField, pValueField, pOutputTable]
return params
def execute(self, parameters, messages):
i = 1
cur = arcpy.da.UpdateCursor(parameters[0].valueAsText,
[parameters[2].valueAsText],
None,
None,
None,(None,'ORDER BY ' + parameters[1].valueAsText))
for row in cur:
cur.updateRow([i])
i = i + 1
del cur
return