AnsweredAssumed Answered

Add new row to empty file geodatabase table

Question asked by claudines on Mar 4, 2013
Latest reply on Mar 5, 2013 by mzcoyle
I am using ArcGIS 10.1 and have created a script that checks to see if a file geodatabase table is empty. It is a table with no spatial referencing.

The code I have thus far can add rows to tables that already have a record in it, but it will not add a new row to an empty table.

Can this be done? Would it be better accomplished if it were a dbf file rather than a geodatabase table?

Snippet of code looks like this:

    addRow =arcpy.da.InsertCursor(Variable1,("Frequency", "Used", "Region"))
    result = arcpy.GetCount_management(Variable1)
    print result
    print addRow
    if result == 0:
    [indent]addRow.insertRow((0, "Locally", 3))[/indent] 
    [indent]do something else[/indent]

result and addRow printouts are correct. Prior tests taking out the if, else statements and just running the addRow.insertRow statement showed that tables that have at least one record get appended with a new row.

So I am of the opinion that I cannot add a new row using this approach. Any other ideas as to how I can add a row to an empty table.

Many thanks.