I'm trying to use an if statement in the field calculator: This is what the code looks like in Python:
a= 2 FacilityID= !FACILITYID! if a%2==0: MH_ID_Calc=FacilityID[0:6] else: MH_ID_Calc=FacilityID[7:14] print MH_ID_Calc
so I tried to run that in ArcGIS field calculator:
def myCalc(FID,FACID): if FID%2==0: return FACID[0:6] else: return FACID[7:14] myCalc( !FID! !FACILITYID!)
But it fails each time.