Select to view content in your preferred language

Can I use the value from the get count tool in a calculate field statement in model builder

1175
2
08-23-2018 03:09 PM
SeanWray
Emerging Contributor

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.

NOTE: I know VERY LITTLE Python. I'm using ArcGIS 10.5 Advanced license.

0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

wouldn't that be a join if you have the counts by feature?

0 Kudos
curtvprice
MVP Esteemed Contributor

You can refer to the output of the Get Count in your Calculate Field expression as %Value% or whatever the output of Get Count in the name. Model variables output from tools are string representations (ie str() of the result object) so they will get interpreted by the tool as the string, ie the value "%Value% / 4.0" is seen by the Calc Field tool as "23 / 4.0".

But I agree with Dan that it sounds like what you really want to do is run an Identity (or Join by Location) to create a table which you can then run through the Statistics tool to do your tabulation, followed by a Join Field to add the results to your line table.