Expression
Lydia
cssaua at hotmail.com
Tue Apr 7 11:00:08 EDT 2009
I am working on calculating one of the fields in a feature class based on other 2 fields. The logic is,
A (the resulting field) is calculated from B, but C and D have part of the value that could fill the blank of B, which meaning that combine three fields of values can make A.
Field A is what I need.
The data looks like: .
A B C D
2 2
5 5
4 4
6 6
cur = gp.UpdateCursor(data)
row = cur.Next()
gp.CalculateField_management(data, "A", "[B]", "VB", "")
while row:
cur.UpdateRow(row)
if not(row.GetValue("C") == 'NULL'):
row.SetValue("A",row.GetValue("C"));
elif not(row.GetValue("D") == 'NULL'):
row.SetValue("A",row.GetValue("D"));
row = cur.Next()
del cur
del row
But the out looks like only B was calculated to A successfully. C&D are not in A.
I guess there must be something wrong with the code, but I am very new to Python, and not familiar with the expression. Could anybody help ? PS. I am coding Python with ARCGIS.
Thanks a lot.
Lydia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090407/55f46bde/attachment.html>
More information about the Python-list
mailing list