claudines

Need help looping thru list of tables and appending results to dbf

Discussion created by claudines on Feb 28, 2013
I have created a multiple tables using the ArcGIS 10.1 tabulate intersection tool and want to automate the following process in python 2.7 within an open map document:

I  want a list of the table names (lakes, parks, voting districts, school zones) that will reference their respective tables on a field called "percentage".

For each table in the list
  if <first item in list> table is empty
    number=1
  else if percentage between 0 and 100
    number=2
  else (percentage = 100)
    number=3
property = name of item in the list

then output to dbf table (percentages) created on the fly that contains 2 fields: Property and Number, where Property equals "lakes" and Number equals the value of the number. (I will be iterating through several layer types and appending to a table.)

Thus record one will look like this if percentage is 36%:

Property    Number
lakes         2

Repeat with next item on the list and append to percentages table.This if parks table was empty, the second record would be:

parks         1

Final table might look like this depending on results from tabulate intersection:

Property    Number
lakes         2
parks        1
voting districts    2
school zones     3

Ideas as to how to do this in python?

Outcomes