AnsweredAssumed Answered

Converting Field Calculator Pre-Logic Script to pyscript

Question asked by Cheekychives on Jul 1, 2016
Latest reply on Jul 1, 2016 by Cheekychives

I've been struggling to emulate a simple Field Calculator function as pyscript. When I try, I get parsing errors.

For example, how should this simple function (when manually applied in the Field Calculator tool) look when written up as pyscript?


In Pre-Logic Script Code:

def LookUp ( a, b ) :

  if ( a == 0 ) : 

    newval = 0

  else :

    newval = b

  return newval



LookUp ( !MAX_RANK!, !Shape_Area! )


Any advice will be much appreciated.