Skip to main content
Removed question from Answer
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

can you elaborate on your requirement a little more? ItIt appears that you're trying to conditionally calculate the value of field 2 based on the value of field 1. you could do the entire operation in a python script using a combination of Mike's suggestion and an UpdateCursor something like this:

cursor = gp.UpdateCursor(yourfeatureclass)
row = cursor.Next()

while row:
     for row.GetValue("yoursourcefield") in ["foo", "bar", "snafu"]:
          row.YOURTARGETFIELD = "your target value"
     cursor.UpdateRow(row)
     row = cursor.Next()

otherwise, using just the pre-logic and the calculator, if it's just a boolean check, personally I'd do the inverse of what Mike suggested:

if [field1] not in ["x","y",z"]"z"]:
     [field2] = "NO WAY JOSE"
else:
     [field2] = "shoot'em up cowboy"

can you elaborate on your requirement a little more? It appears that you're trying to conditionally calculate the value of field 2 based on the value of field 1. you could do the entire operation in a python script using a combination of Mike's suggestion and an UpdateCursor something like this:

cursor = gp.UpdateCursor(yourfeatureclass)
row = cursor.Next()

while row:
     for row.GetValue("yoursourcefield") in ["foo", "bar", "snafu"]:
          row.YOURTARGETFIELD = "your target value"
     cursor.UpdateRow(row)
     row = cursor.Next()

otherwise, using just the pre-logic and the calculator, if it's just a boolean check, personally I'd do the inverse of what Mike suggested:

if [field1] not in ["x","y",z"]:
     [field2] = "NO WAY JOSE"
else:
     [field2] = "shoot'em up cowboy"

It appears that you're trying to conditionally calculate the value of field 2 based on the value of field 1. you could do the entire operation in a python script using a combination of Mike's suggestion and an UpdateCursor something like this:

cursor = gp.UpdateCursor(yourfeatureclass)
row = cursor.Next()

while row:
     for row.GetValue("yoursourcefield") in ["foo", "bar", "snafu"]:
          row.YOURTARGETFIELD = "your target value"
     cursor.UpdateRow(row)
     row = cursor.Next()

otherwise, using just the pre-logic and the calculator, if it's just a boolean check, personally I'd do the inverse of what Mike suggested:

if [field1] not in ["x","y","z"]:
     [field2] = "NO WAY JOSE"
else:
     [field2] = "shoot'em up cowboy"
Source Link
Luke
  • 341
  • 4
  • 11

can you elaborate on your requirement a little more? It appears that you're trying to conditionally calculate the value of field 2 based on the value of field 1. you could do the entire operation in a python script using a combination of Mike's suggestion and an UpdateCursor something like this:

cursor = gp.UpdateCursor(yourfeatureclass)
row = cursor.Next()

while row:
     for row.GetValue("yoursourcefield") in ["foo", "bar", "snafu"]:
          row.YOURTARGETFIELD = "your target value"
     cursor.UpdateRow(row)
     row = cursor.Next()

otherwise, using just the pre-logic and the calculator, if it's just a boolean check, personally I'd do the inverse of what Mike suggested:

if [field1] not in ["x","y",z"]:
     [field2] = "NO WAY JOSE"
else:
     [field2] = "shoot'em up cowboy"