I've hit a wall with a field calculation.I'm writing a calculation for a full address field formed by the values of several other string fields. This is what I have:Expression = fulladdress(!AddNum!, !Prefix! , !Street! , !Type! , !Suffix! , !Unit!)def fulladdress(num, prefix, street, sttype, suffix, unit):
# Concatenate fields
# for addresses without unit
if unit:
fulladd = num +' '+ prefix+' '+street+' '+sttype+' '+suffix+' #'+unit
# for addresses with unit
else:
fulladd = num +' '+ prefix+' '+street+' '+sttype+' '+suffix
# Remove unwanted spaces
fulladd = fulladd.strip()
fulladd = fulladd.replace(' ',' ')
return fulladd
It works exactly as I expect... except that it ignores the IF statement completely. I've tried several different ways of forming the IF, but none work as expected. My calculated result is always what it should be if there's a value in the unit field.I think I've missed something very basic...