Please see screenshot for field calculator Python logic. I have no idea what I'm doing that's any different from this GISSE answer.
The error I receive is ERROR 000989: Python Syntax Error (invalid syntax line 3). What am I missing?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
You're mixing returning values from a function and assignment. You have to return the modified value, not assign it to the old variable. The correct format for the pre-logic script code would be:
def mycalc(ADM2_NAME, Projects): if ADM2_NAME == "Bo": return (Projects + 1) else return Projects
Although there is an even better (shorter) way of doing this, without using the pre-logic code. Just type in the bottom field:
(!Projects! + 1) if (!ADM2_NAME! == "Bo") else !Projects!
which increments the value of the
Projects field value by 1 where the