AnsweredAssumed Answered

multiply values from fieldlist into new field

Question asked by ehm119 on Jan 18, 2012
Latest reply on Jan 18, 2012 by ehm119
Hi,

I am trying to select a subset of fields and multiply the values into a new field.  I am having no problems creating a list of fields.  From there I'm not sure if I should be using CalculateField_managment  or an UpdateCursor.  Or both?  Any help or direction would be greatly appreciated.  Although I;ve tried several avenues, I haven't gotten very far yet...

import arcpy arcpy.env.workspace = r"K:\Data\PythonTest.gdb" fc = "FeatureClass"  #Create list of fields that begin with "WR_" .. I want to multiply all of these together and write values to a new field "Product" FieldList = arcpy.ListFields(fc, "WR_*", "All") rows = arcpy.UpdateCursor(fc)  for field in FieldList:     fName = field.name     print fName  #Everything up to here works-- I get a list of the fields I want      #Open an update cursor for row in rows:     for field in FieldList:         CurrVal = row.getValue(field)  # this doesn't work & I'm not sure how to proceed from here

Outcomes