Hi,
I am trying to solve a problem with Python and need some advice on how to get started.
My problem is this:
I have an raster attribute table with an unknown number of fields with similar names, such as AGE1, AGE2, AGE3, ??? ,AGEn. For each row in the table I want to calculate the sum of the values in all the fields starting with AGE and send the sum to a new field, let???s call it TotAGE.
So for example, if I have three fields called AGE*, I want my resulting table to look like this:
RowID1 AGE1 AGE2 AGE3 TotAGE
1 2 4 6 12
2 3 2 2 7
My problem is that the number of AGE-fields varies so I can???t use a static field calculaion like: Totage = AGE1 + AGE2 + AGE3
My original idea was to create a fieldlist using ListFields with a the wildcard AGE*, then open up a searchcursor where I use the fieldlist to catch my relevant fields and finally for each row to summarize the values in the fieldlist and send it to the new field with an insertcursor. Something tells me that???s not best way to approach this???
Any help is appreciated!
Of course, if there???s a way to do this without using Python, that???s fine too.