Need help using Python in a Calculate Field operation

Discussion created by GlennK on Sep 8, 2012
Latest reply on May 18, 2017 by kimo
Windows XP Pro SP3
ArcView 10.0 SP2

I have a pretty simple task that would be well suited for the attribute table's Calculate Field functionality, but I don't even know where to start as far as doing this with Python. I've written dozens of Python standalone scripts, so I don't think it's a language issue. I just don't know how to do this in the Calculate Field window.

I have five fields involved in this calculate.

Fields A1, A2, B1 and B2 are Long Integer fields. This is the logic:

if (A1 == B1 and A2 == B2):
  return "A AND B IDENTICAL"
  return "OK"

I would like the returned value to appear in field C.

Now how in the heck would this be done in the Calculate Field window? there a trove of Python code block examples somewhere?