Dim Output If IsNull([MyField2]) Then Output = [MyField1] Elseif Trim([MyField2]) = "" Then Output = [MyField1] Else Output = [MyField1] & "-" & [MyField2] End If
def Concatenate(field1,field2): if field2 == "": return field1 else: return field1 + '-' + field2
Concatenate(str(!MyField1!), str(!MyField2!))
def myFunction(one,two): if one == "": # check if first field is <null> if two == "": # check if both fields are <null> and returns <null> pass else: return two # otherwise, just return the second field value else: # check if the first field is populated... if two == "": # if second field is blank return one # return just the first field else: # if both fields are populated return one + "-" + two # return a concatenation of the fields with a hyphen deliminator
myFunction(str(!field1!), str(!field2!))
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.