nepomuck0

insert Python Code into "Calculate Field"

Discussion created by nepomuck0 on Mar 26, 2014
Latest reply on Mar 28, 2014 by FLBB
Hi all,

I try to reclass a field based on different fields of the same feature class. Therefore i want to use a python code.


Field Name: Bewertung_BioZ

Expression:  classification(!Bewertung_BioZ!, !Fischindex! , !IBCH! , !Makro_Index! , !Saprobien_klasse! , !Laichgebiet_Nase! , !aesche_kerngebiet! , !aesche_verbreitung! , !Hydro_pressure! )

Code Block:
def classification(Bewertung_BioZ):
 if (!Fischindex! = 1 or !Laichgebiet_Nase!=1 or !aesche_kerngebiet!=1):
  return 3
 elif ( !IBCH!=1 and !Hydro_pressure!=0):
  return 3
 elif ( !IBCH!=0 and !Makro_Index!=1 and !Hydro_pressure!=0):
  return 3
 elif ( !IBCH!=0 and !Makro_Index!=0 and !Saprobien_klasse! =1 and !Hydro_pressure!=0):
  return 3
 elif ( !IBCH!=1 and !Hydro_pressure!=1):
  return 2
 elif ( !IBCH!=0 and !Makro_Index!=1 and !Hydro_pressure!=1):
  return 2
 elif ( !IBCH!=0 and !Makro_Index!=0 and !Saprobien_klasse! =1 and !Hydro_pressure!=1):
  return 2
 elif ( !Fischindex! =2):
  return 2
 elif ( !aesche_verbreitung! =1):
  return 2
 elif ( !IBCH!=2 and !Hydro_pressure!=0):
  return 2
 elif ( !IBCH!=0 and !Makro_Index!=2 and !Hydro_pressure!=0):
  return 2
 elif ( !IBCH!=0 and !Makro_Index!=0 and !Saprobien_klasse! =2 and !Hydro_pressure!=0):
  return 2
 elif ( !IBCH!=2 and !Hydro_pressure!=1):
  return 1
 elif ( !IBCH!=0 and !Makro_Index!=2 and !Hydro_pressure!=1):
  return 1
 elif ( !IBCH!=0 and !Makro_Index!=0 and !Saprobien_klasse! =2 and !Hydro_pressure!=1):
  return 1
 else:
  return 0


Does any one See the fault(s)?  There is close a Parsing error in line two:

windowERROR 000989
Python syntax error: Parsing error SyntaxError: invalid syntax (line 2)

I appreciate every single Help or hint!

Outcomes