I have a the following value method in my dynamic value table#:
([ADDRNUM]+" "+[ROADPREDIR]+" "+[FULLNAME]+" "+[ROADPOSTDIR]+" "+[UNITTYPE]+" "+[UNITID])
When any of these values is null, the resulting concatenation contains extra spaces. What would be the best way to ensure no extra spaces are created?
Thanks
It seems odd to me that a blank space is inserted for a <null> value. One thing that I do notice you are using the + operator. You might try the & operator instead. You could do a series of nested IIF statements to check of <null> values, but that's going to get ugly.
Bob, I have the same problem using the field calculator in a geodatabase feature class to concatenate values. I have tried a few snippets of things posted here and I either get a blank space where a <null> would be or the entire result is <null> when the calculation hits a <null> field. I've tried + and & with similar results. I thought I had this licked once but can't find a saved .cal file so here I am again ...
a = ['a', 'b', None, 'c', 'd'] # values from a field for demonstration
" ".join(["{}".format(i) for i in a if i]) # the trick is the 'if i' part
# ---- yields ---
'a b c d'
Rather than deal with nulls, I did a selection [Problem Field] IS NULL then used the field calculator to replace <null> with ""
Not very elegant, a bit tedious, but it works and then allows my old concatenation calculation to work properly. I've wasted enough time on solving this.
Dan, in another post you talk about not having tables with nulls. How do you create a new feature class in a geodatabase that contains no nulls?
Dave