AnsweredAssumed Answered

Python field calculator syntax

Question asked by marcguidry on Jan 31, 2012
Latest reply on Feb 1, 2012 by marcguidry
I keep getting a syntax error, but I'm not sure where the problem is.  Any suggestions?

The point of this is to concatenate a Last name field and First name field separated by a comma if there is both a last and first name.  If one of the fields is blank, it leaves out the comma (there are no nulls).

def name (!OWNER1_LAST_NAME!, !OWNER1_FIRST_NAME!) if len(!OWNER1_FIRST_NAME!)>0 and len(!OWNER1_LAST_NAME!)>0:   return !OWNER1_LAST_NAME! & ', ' & !OWNER1_FIRST_NAME! else:   return !OWNER1_FIRST_NAME!+!OWNER1_LAST_NAME!


name (!OWNER1_LAST_NAME!, !OWNER1_FIRST_NAME!)


Thanks,
Marc

Outcomes