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?
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
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
if (Z > 0) and (AF > 0): val = T + Z + AF #or = sum( [T, Z, AF] ) row.SetValue(Outfield, val) cur.UpdateRow(row)
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 (Z > 0) and (AF > 0): row.SetValue(Outfield, T + Z + AF) #or = sum( [T, Z, AF] ) cur.UpdateRow(row) elif (Z > 0) and (AF < 0): row.SetValue(Outfield, T + Z) #or = sum( [T, Z ] ) cur.UpdateRow(row) elif (Z < 0) and (AF > 0): row.SetValue(Outfield, T + AF) #or = sum( [T, AF] ) cur.UpdateRow(row) else: row.SetValue(Outfield, T) cur.UpdateRow(row) row = cur.Next() del cur
I think I am close (with your help of course); but what do you think is wrong with this? It runs without completing, on a relativley small sample.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 (Z > 0) and (AF > 0): Outfield = T + Z + AF #or = sum( [T, Z, AF] ) elif (Z > 0) and (AF < 0): Outfield = T + Z #or = sum( [T, Z ] ) elif (Z < 0) and (AF > 0): Outfield = T + AF #or = sum( [T, AF] ) else: Outfield = T del cur
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 (Z > 0) and (AF > 0): Outfield = T + Z + AF #or = sum( [T, Z, AF] ) elif (Z > 0) and (AF < 0): Outfield = T + Z #or = sum( [T, Z ] ) elif (Z < 0) and (AF > 0): Outfield = T + AF #or = sum( [T, AF] ) else: Outfield = T del cur
while row: if (Z > 0) and (AF > 0): Outfield = T + Z + AF #or = sum( [T, Z, AF] ) elif (Z > 0) and (AF < 0): Outfield = T + Z #or = sum( [T, Z ] ) elif (Z < 0) and (AF > 0): Outfield = T + AF #or = sum( [T, AF] ) else: Outfield = T row = cur.next() # <-------------missing the move to the next row
....stuff before if (Z > 0) and (AF > 0): x = sum( [T, Z, AF] ) #or x = T + Z + AF elif (Z > 0) and (AF < 0): x = sum( [T, Z ] ) #or x = T + Z elif (Z < 0) and (AF > 0): x = sum( [T, AF] ) #or x = T + AF else: x = T .... stuff after
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.