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

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Apr 9, 2018 at 16:23
2
  • 1
    you using PropClass and PropType, which one is it lol Commented Apr 9, 2018 at 16:40
  • 1
    Please always provide code and errors as text rather than pictures. Commented Apr 9, 2018 at 20:08

1 Answer 1

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.

answered Apr 9, 2018 at 16:36
4
  • 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? Commented Apr 9, 2018 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). Commented Apr 9, 2018 at 16:52
  • 1
    @RJJoling right, or def reclass(LandUseField1, LandUseField2). Commented Apr 9, 2018 at 16:57
  • show us a screenshot of your table and the fields you want to use we can provide code Commented Apr 9, 2018 at 17:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.