Does anyone have a suggestion on how to otherwise solve the problem …
The need to automatically generate all the columns from the table, the calculation of the sum, the results are updated in the new column? Recognizing the conditions: 1) did not know the names of columns 2) the name of the column to update the known
example table:
PS
I am an absolute beginner in python programming
import arcpy, os, string
fc = "D:\path\test.shp"
fieldNameList = []
fields = arcpy.ListFields(fc, "*")
for field in fields:
if field.type in ("Double", "Integer", "Single", "SmallInteger"):
fieldNameList.append(field.name)
fn = "'" + "', '".join(fieldNameList) + "'"
print(fn)
with arcpy.da.UpdateCursor(fc, [fn]) as cursor:
for row in cursor:
row[4] = row[0] + row[1] + row[2] + row[3]
cursor.updateRow(row)
ERROR – RESULT
>>>
'tt', 'ff', 'vv', 'rr', 'update'
Traceback (most recent call last):
File "E:pathtest.py", line 17, in <module>
for row in cursor:
RuntimeError: A column was specified that does not exist.
>>>