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
06M244
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.
myCalc(!FID!, !FACILITYID!)? There's a comma missing when you call the function – Bjorn Feb 01 '17 at 21:43myCalc(!FID!, !FACILITYID!)- If you fix these, do you still get an error? If so please [edit] your question to include the error message – Midavalo Mar 31 '17 at 00:34