AnsweredAssumed Answered

Variable passing problem

Question asked by hadpadmasiri on Nov 27, 2014
Latest reply on Nov 27, 2014 by Dan_Patterson

dear sir!

 

I wrote a python function to replace an attribute. But variable "a & b" not passing through CalculateField_management.

Can you give me an advice to correct it.

Thanks

 

Padmasiri

def foo(s1):

    return "'{}'".format(s1)

def BoundCal(a,b):

   New_Name = arcpy.AddFieldDelimiters(env.workspace, "PCL_LN_CD")

    where1 = New_Name + '=' + foo(str(a))

    arcpy.SelectLayerByAttribute_management("ABC_Lyr", "NEW_SELECTION", where1)

    arcpy.CalculateField_management("ABC_Lyr", "PCL_LN_CD", "!PCL_LN_CD!.replace(\"a\", \"b\")" , "PYTHON_9.3" "")

Outcomes