I am trying to create a model that will iterate through all the files in a Database, return the counts of each feature class, then add them all together to get a final count and put the result in a table. I have created an iterator that goes through the database and summarizes each feature class, but now I want to get a total count of the features.
About 10 years ago, before I learned ArcPy where iteration is much easier, which was also before iterators were available in ModelBuilder, I believe I was able to do tasks such as this using ModelBuilder.
I think the keys to doing it now would be:
- Prior to iterating have an empty table with a field to hold your counts for each feature class - let's call this ALL_COUNTS
- Prior to iterating have a one row table with a field to hold your count for one feature class - let's call this ONE_COUNT - there's no need to have a value in that row because we'll be writing and overwriting its value at each iteration
- The schema for All_COUNTS and ONE_COUNT should be identical because we'll be using them in the Append tool
- At each iteration use Get Count to count the features and inline substitution to write it into ONE_COUNT via Calculate Field, then Append the current contents of ONE_COUNT onto ALL_COUNTS
- Once all iterations are complete use Summary Statistics to SUM the values of ALL_COUNTS