Hi,
I am wondering if there is a tool that will look at a row, find the maximum value from column A, B, or C and then update column D with the name of the highest-ranked column. I could implement this as a cursor in Python but I would like to know if there is a set-based method that could be performed with ArcGIS Desktop (I have previously done this in SQL Server, but want to keep the requirements to a minimum).
At this stage the data is a polygon derived from an intersect, but it could also be modelled as a series of rasters.
Thanks,
Matt
getMaxField(!FIELD_A_1!, !FIELD_A_2!, !FIELD_A_3!, "FIELD_A_1", "FIELD_A_2", "FIELD_A_3" )
def getMaxField(v1, v2, v3, name1, name2, name3): maxval = max(v1,v2,v3) if maxval == v1: return name1 if maxval == v2: return name2 return name3
def getMaxField(*args):
getMaxField(!FIELD_A_1!, !FIELD_A_2!, !FIELD_A_3!, "FIELD_A_1", "FIELD_A_2", "FIELD_A_3" )
nfields = len(args) vals = args[0:nfields/2] fields = args[nfields/2:nfields]
maxValue = max(vals)
i = vals.index(max(vals))
return fields
def getMaxField(*args): nfields = len(args) vals = args[0:nfields/2] fields = args[nfields/2:nfields] i = vals.index(max(vals)) return fields