0

I'm defining a string field based on contents of another string field. Simply put, if the contents of field A contain this value, then fill field B with this text.

It throws a string related error message which I don't understand how it fits into the error.

What am I not seeing here?

enter image description here

  • 1
    you using PropClass and PropType, which one is it lol – NULL.Dude Apr 9 '18 at 16:40
  • 1
    Please always provide code and errors as text rather than pictures. – PolyGeo Apr 9 '18 at 20:08
6

You are only passing one variable into your function: PropType. But on the first line of your function, you refer to a variable named PropClass. Your function has no idea what this variable is, because you haven't defined it inside the function, and you haven't passed it into the function as an input. It sounds like you want to do that, so your function's first line should read:

def reclass(PropType, PropClass)

And your function call should read:

reclass(!PropType!, !PropClass!)

Side note: your variable names do not need to match your field names, that may be part of your confusion.

  • Thank you very much. That could be part of the confusion. Can you give an example of how to better approach naming variables in this context? Proptype > num and Prop class > text What would you name it? – zemken12 Apr 9 '18 at 16:43
  • 2
    I think Dan_C meant that the arguments in the function don't have to have the same names as they are in the feature class. Such that the function call will be reclass(!PropType!, !PropClass!), but the function definition could be def reclass(a, b). – RJJoling Apr 9 '18 at 16:52
  • 1
    @RJJoling right, or def reclass(LandUseField1, LandUseField2). – Dan C Apr 9 '18 at 16:57
  • show us a screenshot of your table and the fields you want to use we can provide code – NULL.Dude Apr 9 '18 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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