1

I have two fields in my model, the first is a spatial join return for the township, the second is a spatical join to a city. If there is not city, then the field is left blank. The column that has the city name, I wanted to use a if/then statment to fill in the blank columns with the township name, does anyone have any idea how I would write this or if this is even possible?

2

here is an example with the Python parser

code block

def fillBlank(city, township):
    if (city == ""):
        return township
    else:
        return city

expression (name of fields between ! !) :

fillBlank(!cities!, !township!)

0

Could you do it where you first spatial join to the city polygons, then do an attribute select to find where this column is blank, and then spatial join to the township polygons? Most Arc tools respect selections and only operate on selected records.

0

The vb script version is basically the same as the Python version posted by radouxju in terms of its logic. The code below also handles Null values in the Cities field.

If IsNull([Cities]) Then
  Output = [Township]
ElseIf [Cities] <= " " Then
  Output = [Township]
Else
  Output = [Cities]
End If

Expression: Output

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.