Select to view content in your preferred language

Sum a list of fields

3945
10
Jump to solution
05-07-2018 01:35 PM
GrantHaynes
Occasional Contributor

I'm writing a python script that loops through a number of input data sets and in the process adds a new field with a unique field name and populates it with a value at the same time the script records the field names in a list for later use. These data sets are then unioned together at the of the script and I'd like to build in the function to sum all the newly added fields into a total field at the end. I'm trying to use the calculate field tool to sum the fields, but I cannot seem to get it right and I can't seem to figure it out.

0 Kudos
10 Replies
DanPatterson_Retired
MVP Emeritus

If you are using PRO, see

Descriptive statistics for multiple fields

A row sum of the selected fields is one of the outputs.  

If you don't want to use a pre-existing solution, then pull the code you need from it.