I have zero experience with python and very little experience with ModelBuilder in ArcGIS. I have a shapefile with two fields, let's say their names are "Function" and "Regulation". What I need to do is to select by attributes from the field "Function" and write a specific text in the field "Regulation". Now I'm doing it manually, e.g. I select by attributes where "Function" is 'sport' and then via field calculator I write the text into the field "Regulation". Then I select by attributes other fields in "Regulation" and so on. What I want to do is to automate the whole process, because in the future I'll do this for other shapefiles with similar values in the fields, so my idea was to have a script, where I would only rewrite the values which are different.
Any ideas how to do it?
I've tried these scripts:
Expression:
Reclass (!Regulation!)
Code Block:
def Reclass (Function):
if (Function == "sport"):
return "400_TXT\888_B.txt"
elif (Function == "water"):
return "400_TXT\888_D.txt"
and this one:
def Reclass (Function):
dict = {
"sport" :"400_TXT\888_B.txt" ,
"water" :"400_TXT\888_D.txt" ,
}
I had an error "field is not nullable", so I tried these scripts in the feature class in gdb, but the fields were not updated.