vendredi 3 juillet 2020

IF, ELIF, ELSE ArcPro How to calculate a field

I am trying to calculate a field based on another field. If my ELcorrect field is a certain number then the Part field needs to be either Drift1, Drift2, Drift3 etc or else Ramp for all other values. Here is my code:

def TheCoder(code):
  if code==-266:
    var="Drift1"
  elif code==-265:
    var="Drift2"
  elif code==-262:
    var="Drift3"
  elif code==-251:
    var="Drift4"
  elif code==-250:
    var="Drift5"
  else:
    var="Ramp"
  return var

With the Part=TheCoder(!ELcorrect!)

It runs successfully but it doesn't populate anything. So not sure what exactly it is doing.

Aucun commentaire:

Enregistrer un commentaire