0

I'm trying to calculate new values for a field based on two other fields. In VB I don't have any problem, but I need to use python to publish my gp service.

1

2

3
  • 3
    You do not say the error returned but I think the problem is that you are using "= =" when it should be "==" (in two places).
    – PolyGeo
    Nov 9, 2014 at 19:51
  • 3
    I'm also not sure how well Field Calculator handles the ó in Dirección. Perhaps try a standard o instead?
    – nmpeterson
    Nov 9, 2014 at 20:13
  • It's also not clear whether you have been inconsistent with your indent levels. To me it looks like a one space indent before if and two more spaces before return.
    – PolyGeo
    Nov 9, 2014 at 22:20

1 Answer 1

2

Taking account of the comments by @nmpeterson and myself against your question, I would try the following:

Pre-logic Script Code:

def a(Riesgo,Direccion):
    if (Riesgo == "Alto" and Direccion == "Sur"):
        return "Sur"

Mensaje =

a(!Riesgo!,!Dirección!)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.