Hello! I am still learning the basics.
I have a several tables in a .gdb that I have assigned as a variable: (The reason being I am building a script tool for handling multiple fc and tables to generate a location based report on facilities and infrastructure. I am creating template tables to then use when I run summary statistics, and I want to account for instances where some layers Objectid count == 0, in that case, a row is not generated, and then it causes issues when appending each layer to the final table even if to just say "0")
This is what I have:
import os
arcpy.env.workspace = r"path.gdb"
listTables = arcpy.ListTables("*qual_text")
print(listTables)
rows = arcpy.InsertCursor(listTables)<-----this is where it errors out "does not exist"
# Create 25 new rows. Set the initial row ID and distance values
for x in range(1):
row = rows.newRow()
row.setValue("FREQUENCY", 0)
row.setValue("COUNT_OBJECTID", 0)
row.setValue("FAC_TYPE", )
rows.insertRow(row)
# Delete cursor and row objects to remove locks on the data
del row
del rows
print("Row Added")
I am getting an error about the tables not existing, but they print out and indeed do exist in the path I set. do I have bad code formatting?
How do I use InsertCursor (or any other method) to insert 1 row with default values for fields (Already exist)?
Thanks in advance!