import sys, string, os, math, arcgisscripting gp = arcgisscripting.create(9.3) gp.OverWriteOutput = 1 FC = gp.GetParameterAsText(0) Z = gp.GetParameterAsText(1) AF = gp.GetParameterAsText(2) T = gp.GetParameterAsText(3) Outfield = gp.GetParameterAsText(4) cur = gp.UpdateCursor(FC) row = cur.Next() while row: if row.GetValue == (Z > 0) and (AF > 0): row.SetValue(Outfield, T + Z + AF) #or = sum( [T, Z, AF] ) elif row.GetValue == (Z > 0) and (AF < 0): row.SetValue(Outfield, T + Z) #or = sum( [T, Z ] ) elif row.GetValue == (Z < 0) and (AF > 0): row.SetValue(Outfield, T + AF) #or = sum( [T, AF] ) else: row.SetValue(Outfield, T) cur.UpdateRow(row) row = cur.Next() del cur
import sys, string, os, math, arcgisscripting gp = arcgisscripting.create(9.3) gp.OverWriteOutput = 1 FC = gp.GetParameterAsText(0) Z_fld = gp.GetParameterAsText(1) AF_fld = gp.GetParameterAsText(2) T_fld = gp.GetParameterAsText(3) Outfield = gp.GetParameterAsText(4) cur = gp.UpdateCursor(FC) row = cur.Next() while row: Z = row.GetValue(Z_fld) AF = row.GetValue(AF_fld) T = row.GetValue(T_fld) if (Z > 0) and (AF > 0): val = T + Z + AF #or = sum( [T, Z, AF] ) elif (Z > 0) and (AF < 0): val = T + Z #or = sum( [T, Z ] ) elif (Z < 0) and (AF > 0): val = T + AF #or = sum( [T, AF] ) else: val = T row.SetValue(Outfield, val) cur.UpdateRow(row) row = cur.Next() del row del cur
Logan - So far so good. I have been testing on a small sample and it is good so far. Thanks for all the assistance. I realized after I posted my previous, that the GetValue needed an object in the (). I see how you used 'val' and it makes sense and runs pretty quickly. I really do appreciate the help.
So no way to 'credit' posts or award points anymore? Mark as answered or complete?