Solved! Go to Solution.
# hard coded row.getValue("AccessDBNo")
# uses variable field = "AccessDBNo" rows = arcpy.SearchCursor(fc) for row in rows: numbers.append(row.getValue(field)) del row, rows
row.AccessDBNo
import arcpy from arcpy import env env.workspace = r"Database Connections\PTWP_Base.sde\PTWP_BASE.DBO.Propose_Facilities" fc = "PTWP_BASE.DBO.Eval_Seg" numbers = [] rows = arcpy.SearchCursor(fc) for row in rows: numbers.append(row.AccessDBNo) del row, rows # Get maximum using max() function, max is a reserved word for max() function. maxi = max(numbers) NextNo = maxi + 1 arcpy.AddMessage("The next available project number is...") arcpy.AddMessage(NextNo)
# hard coded row.getValue("AccessDBNo")
# uses variable field = "AccessDBNo" rows = arcpy.SearchCursor(fc) for row in rows: numbers.append(row.getValue(field)) del row, rows
row.AccessDBNo
import arcpy from arcpy import env env.workspace = r"Database Connections\PTWP_Base.sde\PTWP_BASE.DBO.Propose_Facilities" fc = "PTWP_BASE.DBO.Eval_Seg" numbers = [] rows = arcpy.SearchCursor(fc) for row in rows: numbers.append(row.AccessDBNo) del row, rows # Get maximum using max() function, max is a reserved word for max() function. maxi = max(numbers) NextNo = maxi + 1 arcpy.AddMessage("The next available project number is...") arcpy.AddMessage(NextNo)