ArcGIS ModelBuilder – Using Get Count Tool in Calculate Field

arcgis-desktopcountmodelbuilder

I'm trying to assign the number of crashes (points) found in a buffer to the line segment found in the same buffer. I need to iterate through the rows of the buffer feature class. I have the model built, all i need to do is figure out how to pass the number of selected crashes (Get count) into the Calculate field in the line feature class.

See the attachment of the model I have built.

enter image description here

I know very little Python. I'm using ArcGIS 10.5 Advanced license.

Best Answer

All you need to do is use %Row Count% as the expression in calculate field. Model Builder uses a concept of inline variables which update during the running of the model (through iteration etc. - http://desktop.arcgis.com/en/arcmap/10.3/analyze/modelbuilder/a-quick-tour-of-using-inline-variable-substitution.htm). These are designated through % signs bookending the variable.

Here's somebody asking for essentially the same information on the ESRI community forum a couple of years ago that I dug up (https://community.esri.com/thread/161327). It seems like there's plenty of documentation of inline variables but not many cases of people explicitly advising that this is the nature of the Row Count variable.