dharla2

Trying to calculate values from two different tables using SearchCursor

Discussion created by dharla2 on Nov 9, 2011
Latest reply on Nov 9, 2011 by csny490
It seems like this should be easy but my script is choking on something.  I have two dbf tables that each have a field "SUM_LENGTH".  I want to divide the value of one field by the other.  Each table only has one row so I thought next() would be appropriate to access the row and GetValue would return the value.  I am doing something wrong though.  Any ideas?

strcur = gp.SearchCursor(streamtable,"", "","SUM_LENGTH","")
Artcur = gp.SearchCursor(Arttable, "", "", "SUM_LENGTH", "")
strrow = strcur.next()
artrow = Artcur.next()
strlen = strrow.GetValue("SUM_LENGTH")
artlen = artrow.GetValue("SUM_LENGTH")

index = artlen / strlen
print index
del Artcur
del strcur

#thanks

Outcomes