any idea why this code fails please ?
Like the others have said, you actually have to call the function, and you should compare to None, not space.
x = [1, None, 2] for y in x: print(y is None) # False # True # False
Also, your function is needlessly complicated. Just use something like this:
# BFS_concat_trial = concat_if_not_empty([!Field1!, !Field2!, !Field3!, !Field4!, !Field5!, !Field6!], [None, "", " "], "/") # code block def concat_if_not_empty(values, empty, separator): """Concatenates non-empty values. values: list of values to concatenate empty: list of values considered empty separator: character used for concatenation """ values = [str(v) for v in values if v not in empty] return separator.join(values)
Also, I see the python function, but don't see you calling it:
You need to call update() and pass the variables to it.
R_
You don't seem to account for null at all but it is hard to read
Code formatting ... the Community Version - Esri Community
<null> in python is None not a space
if a not in [None, " ", ""]: # then do something
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.