AnsweredAssumed Answered

Problem in Field Calculator

Question asked by hadpadmasiri on Jul 13, 2015
Latest reply on Jul 13, 2015 by xander_bakker

Dear Sir!

      I tried to customize a field value in polygon featureclass. For that I wrote a python function. Then using Field Calculator, I copy this function to Pre_Logic Script Code: and call the function. it gives me error.

  Then I tried the same using Calculate Field tool in ArcToolbox. It works correctly.

Pl explain why I cannot run the above function using Field Calculator.


My function is given below:

def lblcal(a):

       Dic1 = {'11':'PP', '13':'TOPOPP', '14':'FTP', '15':'VP', '16':'FVP', '17':'CP', '18':'FCP', '19':'FSP', '20':'FSPP', '21':'ISPP', '22':'FUP'}

       if a[2:4] in Dic1.keys():

            m = Dic1.get(a[2:4])

            if (a[9] == 's') is True:

            str1 = 'SUP' + str(int(a[10:15]))


            str1 = 'Inset' + str(int(a[10:15]))

  if (a[15] == 's') is True:

  str2 = 'Sheet' + str(int(a[16:20]))

  str3 = m + ' ' + str(int(a[4:9])) + str1 + str2

  return (str3)


I am working in ArcGIS 9.3