I'm converting a model from v9 to v10 so I have to convert some code from VBA to Python. I'm trying to take a small number from variable Joint_Count, create a rate per 100,000 and put the results in a field called CountProp. I can't divide into 0 so when Joint_Count=0, CountProp should also be 0.
VBA code that worked:
dim CountP as double
if [Join_count] = 0 then
CountP=0
else countP= ([Join_count] / [POP2005])*100000
end if
Python:
Field name: CountProp
Expression: doCount(!Join_Count!)
code (the last of many iterations)
def doCount(Join_Count):
if !Join_Count! = 0:
tempnum=0:
elif !Join_Count!>0:
TempNum=(!Join_Count!/!POP2005!)*100000
return TempNum
I get error 000989, parsing error: invalid syntax (line 3)
Any help would be appreciated