# 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)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.