simple if statement in ArcMap field calculator

المشرف العام

Administrator
طاقم الإدارة
I have two fields containing string variables. The first one is f and the second one is f1. I would like to create a new field and populate it with the following:

if f1 is equal to f, return f1

if f1 is an empty string, return f

if f1 is not equal to f, return f1.

In other words only return f if f1 is blank. Otherwise default to f1. This is the pre logic script code i came up with but its not doing it:

def calc(f,f1): if f == f1: return f1 elif not f1: return f else: return f1I am very new to python as this is my first script. Thanks.



أكثر...
 
أعلى