I'm sure I'm missing something simple. I am just trying to use the API for python to update attributes using functions and values from other fields; but haven't been successful in formatting the the statement correct.
def getTotalDays(load,start):
delta = load-start
days = delta.days
if days ==0:
return 1
else:
return days
calc_dict['field'] = 'totaldays'
#This is not correct:
calc_dict['sqlExpression'] = 'getTotalDays(!{0}!,!{1}!)'.format("dateloadedenterprise","surveydatestart")
result = compliance_svc_lyr.calculate(where=where,calc_expression=calc_dict)
Additionally, I previously used dataframes to update the service, however had the same error as noted in this post, so I'm resorting back to field calculations.