At the end of a geoprocess, I have 25+ shapefiles with various large record counts. I would like to be able to get a quick listing of said counts (with filename for reference) into a database or csv for verification of what I am expecting during the processing.
I looked at Get Count, but I don’t understand how to get the results into a table that I can look at outside of ArcMap.
Preferably I would like to run it as a model or tool and the end of my processing and spit it out in the same place as my output shapefiles.
any help is appreciated
I've come across this chicken and egg problem before. Modelbuilder and it's standard tools don't offer the ability to insert a row of information into a table which is what you are after.
To cycle over the folder and get a count is easy, that is a FeatureClass iterator linked to the get count tool. At that point you have the dataset name from the iterator and the count but how do you store that information....and do it it modelbuilder?
Well the only solution I can think of is to use the model only Calculate Value tool and call some python code to run an insert cursor on an existing table. You would pass in your name and count using inline variable substitution and call a function you create to run the insert. From a users perspective it is all in modelbuilder.
Brian Wade When you run the iterator linked to get count as Duncan Hornby instructed, write the values to a gdb table. Pass the feature class name of the iterator as the field name, and field calculate the %get count% value. If you want to view it outside of Arc in a csv, then add a table to table tool to export that QA table to a csv. You'd need to nest the above as a submodel so that the csv isn't written until the end.
This would give you a field for every feature class name, and 1 row with the value from get count. If you want to view it vertically instead of horizontally, add in the transpose tool in the main model before the csv export.
I haven't tried this with get count tool, but I've used it for a very similar situation. Be the gineau pig!
Brian, I just implemented a way to do this in Model Builder. This toolbox has a main tool that creates the table with two fields, input path and count. I have a second model tool that does this in batch, if you run it you will have a bunch of tables named count_shapefile1, count_shapefile2. You can then put the count tables together with the Merge tool. You can yet create a third model that runs the batch model tool and passes the output to the Merge tool, but let's not get too carried away here.
Afternoon Curtis, Thanks, I've looked the tools you've created however I'm not sure in what sequence I need to run the models in. It appears in batch, both tools output a single table with 1 row and 1 count. Does one need to be connected to another?
The two models are already nested, one model calls the other. The driver model takes a folder as input and runs on every feature class in the input folder. Do not use the ArcMap "right-click-batch" functionality, it does not work with model tools.
For more information on how iteration and nesting models works, see the help:
Afternoon Curtis, I couldn’t get your model to work, I’m sure it’s something simple. I have 5 like tables in a dir., I would like a table output that has a list of 5 rows with populated filename in a column and a count in an adjacent count field. Does this model do this? And if so, how do I get it to work? which one calls the other? Thanks.
Run Row Counts is the model to run, just double click it and enter a workspace, it will go make a count table for every feature class in the workspace, you can then run the Merge tool to put them together.
This tool works on feature classes not tables, because you said shapefiles.