#This scrip is working to a point, but is not what I expected. If Someone could help me with this,
#it would be greatly appricated.......Thank You in advance.
#The GetCount_management "COUNT" for the wHydrant Feature Class is 4457.
#After running the script, the result is four separtate rows in one column. See attached.
#My expectation is only one row and one column.
import arcpy
lyrfile ="C:\\Projects\\DavidSchultise_Southwest_GIs\\SouthwestTesting.gdb\\HydrantTesting\\wHydrant"
result = arcpy.GetCount_management(lyrfile)
print('{} has {} records'.format(lyrfile, result[0]))
#My Table
fc ="C:\\Projects\\DavidSchultise_Southwest_GIs\\Testing.dbf"
for row in (result[0]):
cursor = arcpy.da.InsertCursor(fc, ["NUMBER"])
cursor.insertRow(row[0])
Hmmm, can you just use the below snippet for your count?
int(arcpy.GetCount_management(lyrfile).getOutput(0))
I apologize, I forgot to add that eventually I need to loop through aprox four hundred features classes for an inventory project..............Thank You
First, for the issue at hand with it printing over multiple rows, running this doesn't work?
import arcpy
lyrfile ="C:\\Projects\\DavidSchultise_Southwest_GIs\\SouthwestTesting.gdb\\HydrantTesting\\wHydrant"
fc ="C:\\Projects\\DavidSchultise_Southwest_GIs\\Testing.dbf"
result = int(arcpy.GetCount_management(lyrfile).getOutput(0))
cursor = arcpy.da.InsertCursor(fc, ["NUMBER"])
cursor.insertRow([result])
del cursor
Regarding the fc loop, let us know if you encounter any issues! Are they all in the same gdb?
Hi Chris,
We are a very large Public Water Utility Company with over thirty eight Geodatabases and our asset management group requires an inventory of all their assets. It will be a challenge looping through all of them and with a little help I will get there..................Thank you for checking back with me.
Larry
Larry,
There's a discussion on StackExchange (GIS) that might help you down that path, no pun intended - arcpy - Listing Feature Classes of Multiple geodatabase in Multiple Folder? - Geographic Information...