Calculate Field Parsing Error 000989

5804
2
09-14-2011 01:04 PM
NatalieLepsky
New Contributor
I am getting the error 000989 Python syntax error: Parsing error: invalid syntax (line 1). I can't resolve it though it seems to me that I am doing everything according to instructions.
I have a field MEAS_DIST_OUTLRS_UPD with measurements. I need to update the field using the following conditions:
if MEAS_DIST_OUTLRS_UPD is less or equal 6.0 then the value doesn't change
if MEAS_DIST_OUTLRS_UPD is larger then 6.0 then the value should be 1.0.
I am using 'Calculate Field'. The code block is:
Updmeas( !MEAS_DIST_OUTLRS_UPD! )
Def Updmeas( !MEAS_DIST_OUTLRS_UPD! 😞
     If ( !MEAS_DIST_OUTLRS_UPD! ) > 6 :
     Return  !MEAS_DIST_OUTLRS_UPD!
     Else :
     Return 1
The Expression is
Updmeas( !MEAS_DIST_OUTLRS_UPD! )

What is it that I am doing wrong? Please help!
Tags (2)
0 Kudos
2 Replies
RaphaelR
Occasional Contributor II
hi natalie,

the python function doesn´t take a field itself so you have to pass the field as a variable:
#Codeblock
def Updmeas(value):
 if value > 6:
  return 1

#Expression
Updmeas( !MEAS_DIST_OUTLRS_UPD! ) 
0 Kudos
NatalieLepsky
New Contributor
Thanks, Rafael!
It worked!
0 Kudos