<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic concatenation of items with null values in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/concatenation-of-items-with-null-values/m-p/1307799#M71003</link>
    <description>&lt;P&gt;any idea why this code fails please ?&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jul 2023 23:51:55 GMT</pubDate>
    <dc:creator>Bradmayger</dc:creator>
    <dc:date>2023-07-12T23:51:55Z</dc:date>
    <item>
      <title>concatenation of items with null values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/concatenation-of-items-with-null-values/m-p/1307799#M71003</link>
      <description>&lt;P&gt;any idea why this code fails please ?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 23:51:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/concatenation-of-items-with-null-values/m-p/1307799#M71003</guid>
      <dc:creator>Bradmayger</dc:creator>
      <dc:date>2023-07-12T23:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: concatenation of items with null values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/concatenation-of-items-with-null-values/m-p/1307860#M71014</link>
      <description>&lt;P&gt;You don't seem to account for null at all but it is hard to read&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank"&gt;Code formatting ... the Community Version - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;null&amp;gt; in python is None not a space&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if a not in [None, " ", ""]:
    # then do something&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 09:55:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/concatenation-of-items-with-null-values/m-p/1307860#M71014</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-07-13T09:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: concatenation of items with null values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/concatenation-of-items-with-null-values/m-p/1307901#M71019</link>
      <description>&lt;P&gt;Also, I see the python function, but don't see you calling it:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RhettZufelt_0-1689256955934.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/75323i5F0A19D7149E2624/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RhettZufelt_0-1689256955934.png" alt="RhettZufelt_0-1689256955934.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to call update() and pass the variables to it.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 14:04:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/concatenation-of-items-with-null-values/m-p/1307901#M71019</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-07-13T14:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: concatenation of items with null values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/concatenation-of-items-with-null-values/m-p/1308060#M71043</link>
      <description>&lt;P&gt;Like the others have said, you actually have to call the function, and you should compare to None, not space.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;x = [1, None, 2]
for y in x:
    print(y is None)

# False
# True
# False&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, your function is needlessly complicated. Just use something like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# 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)&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1689279363636.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/75370i793319F55C01AA94/image-size/large?v=v2&amp;amp;px=999" role="button" title="JohannesLindner_0-1689279363636.png" alt="JohannesLindner_0-1689279363636.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 20:16:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/concatenation-of-items-with-null-values/m-p/1308060#M71043</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-07-13T20:16:38Z</dc:date>
    </item>
  </channel>
</rss>

