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?
-
1you using PropClass and PropType, which one is it lolNULL.Dude– NULL.Dude2018年04月09日 16:40:22 +00:00Commented Apr 9, 2018 at 16:40
-
1Please always provide code and errors as text rather than pictures.PolyGeo– PolyGeo ♦2018年04月09日 20:08:51 +00:00Commented Apr 9, 2018 at 20:08
1 Answer 1
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– zemken122018年04月09日 16:43:38 +00:00Commented Apr 9, 2018 at 16:43
-
2I 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 bedef reclass(a, b)
.RJJoling– RJJoling2018年04月09日 16:52:17 +00:00Commented Apr 9, 2018 at 16:52 -
1@RJJoling right, or
def reclass(LandUseField1, LandUseField2)
.Dan C– Dan C2018年04月09日 16:57:49 +00:00Commented Apr 9, 2018 at 16:57 -
show us a screenshot of your table and the fields you want to use we can provide codeNULL.Dude– NULL.Dude2018年04月09日 17:29:38 +00:00Commented Apr 9, 2018 at 17:29
Explore related questions
See similar questions with these tags.