AnsweredAssumed Answered

Returning SUM of Values from a Field Within a Selection Set

Question asked by dosbourne on Oct 31, 2013
Latest reply on Nov 1, 2013 by dosbourne
Basically I want to select line features based on a polygon feature, then return a value that is the sum of all the features in a field that is within the selected set of line features.  Then do this for say, a hundred more feature classes.  I figured there would be a tool, called GetSum or something similar that would do this but did not see it in the Help.  I've explored using Summary Statistics, but that returns a table, not a simple value.  Here is what I've got.  Ideas?

# Create a list of all the polygon feature classes zonePolys = arcpy.ListFeatureClasses("Zone*")  for fc in zonePolys:     arcpy.AddField_management(fc,"SumOfValues","LONG")         arcpy.MakeFeatureLayer_management("OriginalLayer", "OriginalLayer_Lyr")        arcpy.SelectLayerByLocation_management("OriginalLayer_Lyr","INTERSECT",fc)          # Calculate the sum of the values in the selected features in OriginalLayer_Lyr     SumValues = ??     # Take the sum value of the line features field and populate the polygon layer's new SumOfValues field with it     arcpy.CalculateField_management(fc,"SumOfValues",SumValues)