Hi,
I need to get a number of rows with value "1" (ICOUNT field in attached image) throug the calculate value function in model builder. What will be the Expression and Code Block??
Thanks
Mark
The count will yield one value for the table. What will you do with this value? Fill all records of a field with this value? You could use Select Layer By Attribute—Help | ArcGIS Desktop and specify the query ICOUNT = 1 followed by Get Count—Help | ArcGIS Desktop . This will yield a single value. What do you want to do with this value?
Glad it worked! Could you mark the post that best answered your question as the correct answer?
To calculate a value with the Field Calculator will return a value for each record. Since you want to have the result of the count of all values equal to one, only the last and after the last value of one the correct value would be obtained. So you need to loop through all the record to obtain the value and then loop again to write that value to each record. It is possible and if you want to have that value in a field it is probably a good way to go as suggested by curtvprice
Thanks! Xander's method works, I just thought with "calculate value" it will be more elegant
Re: How to determine number of records using arcpy.da.SearchCursor
would be what you could use with Calculate Value, but as discussed in that thread GetCount is almost as fast for a few records and faster for big tables. I vote for Xander's suggestion.
I have a model where I'm going to use this value later, to calculate another parameter.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.