Select to view content in your preferred language

cursor

856
1
03-18-2011 02:28 AM
BartłomiejStaroń
Occasional Contributor
I have something like this:

cursor = gp.SearchCursor(tabela1)
for row in iter(cursor.Next, None):
     gp.CalculateField_management(A_XYOSIE, row.exp_in, row.expression, "PYTHON", "")
     print "Calculate- ",row.expression," do",row.exp_in
    
print "end"


The script calculates the fields in the FC based in the separate table.
How to convert this script to use only cursor?

the  CalculateField not working for unknown reasons to me.
Tags (2)
0 Kudos
1 Reply
ChrisMathers
Deactivated User
The expression is stored in a field in the feature class? Thats a little odd. Ive never seen this 'iter(cursor.Next, None):' before. Thats a neat use of iter. We should have been doing that all along instead of while loops. Anyway, it sounds like youre going to have to convert the expression to a function some how. I suggest trying to lambda a function from the expression field, but since youre expression is probably a string Im really not sure how that would work. Can you provide a line from the table just so we can see what we are dealing with?
0 Kudos