I am calculating a field with arcpy, but I have not been able to obtain the expected results.
expression2="getClass(!DESCRIPCION!)" codeblock2="""def getClass(DESCRIPCION): if '"DESCRIPCION" LIKE ' + "'%CODE%": return 1 """ arcpy.CalculateField_management(in_table=out_gdb + "\Compilado\AccesoriosLineasMecanicas", field="TIPO_EMPALME", expression=expression2, expression_type="PYTHON_9.3", code_block=codeblock2)
for all records in the TIPO_EMPALME field the result is 1, I should do a filter for %CODE%
You are setting the code block to Python but using SQL syntax, so it isn't a surprise the code isn't working. Try using Python syntax, something along the lines of:
if 'CODE' in DESCRIPCION:
return 1
Carlos Bustamante, still having issues?