1

I am trying to update a field "SZone" with the information from field "Zone", based on field "PointOrder". I am trying to use Calculate Field and the following code, but it is not updating.

I am using the expression:

new(!Update!)

def new(Update):
  if (PointOrder ==0):
    return Zone
  else:
    return ""
MacroZED
  • 2,291
  • 1
  • 12
  • 22
  • So you have four fields; Zone, SZone, PointOrder and Update? And depending on the value in PointOrder, you'd like to either update SZone to same value (or function of) as Zone or leave empty? What's with the Update field that you have in your code? – Martin Mar 22 '16 at 14:22

1 Answers1

4

you need to define a function (in your case : new) with all the parameters needed for the computation (in your case, the fields pointOrder and Zone). Then you call your function with those fields. When you define your function, you can use any name for your parameter. When you call your function, the field names need to be written between !yourFieldName! .

new(!PointOrder!,!Zone!)

def new(po, z):
  if (po ==0):
    return z
  else:
    return ""
radouxju
  • 49,636
  • 2
  • 71
  • 144