AnsweredAssumed Answered

working with dates

Question asked by santitopografo1979 on Mar 11, 2017
Latest reply on Mar 13, 2017 by rvburton

Hello! I'm Santi.

 

I've tried make a python code that update a field with machine's date. This results compares another fix field and offers a result in another field.

I need update a field from another one using an intermediate field. This script works in ArcMap but when I try publish as service in WebAppbuilder not works.

Code is below:

"import arcpy
import datetime
arcpy.env.workspace = r'C:\1.SANTI\TFM\20160726_Entrega_VALLADOLID\20160726_Entrega_VALLADOLID\CAPAS_ETRS_89_PARA_PROYECTO\PRUEBAS_ONLINE_2.gdb'
capa = arcpy.GetParameterAsText(0)
current_datetime = datetime.datetime.now()
arcpy.CalculateField_management(capa, "dia_actual", datetime.datetime.weekday(current_datetime))
##print(current_datetime.strftime('%A'))
campos = ['dia_actual', 'dia_libre', 'estado']
with arcpy.da.UpdateCursor (capa, campos) as cursor:
for row in cursor:
if(row [0]==row[1]):
row[2]=2
elif (row[0]<>row[1]):
row[2]=1
cursor.updateRow(row)"

 

Why doesn't work in WebAppbuilder? Do I need make something before publish as service?

 

Thank U for your help.

 

If somebody answer to my mail too this is: santi04082001@gmail.com

 

Thank U again.

Attachments

Outcomes