<?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 Re: Concatenation of Fields in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/concatenation-of-fields/m-p/1287154#M6583</link>
    <description>&lt;P&gt;Error message would be useful.&lt;/P&gt;&lt;P&gt;Are there&amp;nbsp; any nulls in the fields? and are they all text?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;a, b, c, d, e, f, g, h
('a', 'b', 'c', 'd', 'e', '', 'g', 'h')

flds = [a, b, c, d, e, f, g, h]

def update(a, b, c, d, e, f, g, h):
    """concatenate flds"""
    out = ""
    for i in flds:
        if i:
            out += i + "/"
    if out[-1] == "/":
        return out[:-1]
    return out.strip()
   
update(a, b, c, d, e, f, g, h)
'a/b/c/d/e/g/h'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; If so, the above example would seem simpler&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 May 2023 07:58:28 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2023-05-09T07:58:28Z</dc:date>
    <item>
      <title>Concatenation of Fields</title>
      <link>https://community.esri.com/t5/developers-questions/concatenation-of-fields/m-p/1287131#M6582</link>
      <description>&lt;P&gt;I need to concatenate 8 or 9 fields, using "/" between the text, and no spaces if it is blank, the following code had worked, but has since failed.&lt;/P&gt;&lt;P&gt;def update(a, b, c, d, e, f, g, h):&lt;BR /&gt;strArray = []&lt;BR /&gt;if a != ' ':&lt;BR /&gt;strArray.append(a + "/")&lt;BR /&gt;if b != ' ':&lt;BR /&gt;strArray.append(b + "/")&lt;BR /&gt;if c != ' ':&lt;BR /&gt;strArray.append(c + "/")&lt;BR /&gt;if d != ' ':&lt;BR /&gt;strArray.append(d + "/")&lt;BR /&gt;if e != ' ':&lt;BR /&gt;strArray.append(e + "/")&lt;BR /&gt;if f != ' ':&lt;BR /&gt;strArray.append(f + "/")&lt;BR /&gt;if g != ' ':&lt;BR /&gt;strArray.append(g + "/")&lt;BR /&gt;if h != ' ':&lt;BR /&gt;strArray.append(h + "/")&lt;BR /&gt;&lt;BR /&gt;str = "".join(strArray)&lt;BR /&gt;str = str.strip()&lt;BR /&gt;str = str.lstrip("/")&lt;BR /&gt;str = str.rstrip("/")&lt;BR /&gt;return str&lt;/P&gt;&lt;P&gt;BFS_concat =&amp;nbsp;update(!GDE_01B!, !GDE_02B!, !GDE_03B!, !GDE_04C!, !GDE_05B!, !GDE_07B!, !GDE_08B!, !GDE_09B!)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas please ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Brad&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 04:37:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/concatenation-of-fields/m-p/1287131#M6582</guid>
      <dc:creator>Bradmayger</dc:creator>
      <dc:date>2023-05-09T04:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenation of Fields</title>
      <link>https://community.esri.com/t5/developers-questions/concatenation-of-fields/m-p/1287154#M6583</link>
      <description>&lt;P&gt;Error message would be useful.&lt;/P&gt;&lt;P&gt;Are there&amp;nbsp; any nulls in the fields? and are they all text?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;a, b, c, d, e, f, g, h
('a', 'b', 'c', 'd', 'e', '', 'g', 'h')

flds = [a, b, c, d, e, f, g, h]

def update(a, b, c, d, e, f, g, h):
    """concatenate flds"""
    out = ""
    for i in flds:
        if i:
            out += i + "/"
    if out[-1] == "/":
        return out[:-1]
    return out.strip()
   
update(a, b, c, d, e, f, g, h)
'a/b/c/d/e/g/h'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; If so, the above example would seem simpler&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 07:58:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/concatenation-of-fields/m-p/1287154#M6583</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-05-09T07:58:28Z</dc:date>
    </item>
  </channel>
</rss>

