<?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: Merge Address Fields into one... in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206159#M15857</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, you can emulate the following, by simply collecting the field values into a list and assuming you are working in a geodatabase, None should be the equivalent of &amp;lt;Null&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Worth a look... the key is in the ", ".join bit and the test for null&lt;/P&gt;&lt;P&gt;BTW this is python... don't know if vb* has a equivalent, but switch to the python parser to use this idea&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;a &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'a'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'b'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'c'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'d'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;", "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;i &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; a &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;'a, b, c, d'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 10:11:54 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2021-12-11T10:11:54Z</dc:date>
    <item>
      <title>Merge Address Fields into one...</title>
      <link>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206158#M15856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class=""&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I have a large (20+ million) address database point FC in FGDB format. Each address record is split into multiple fields like 'organisation', 'building name', 'building number', 'post town', 'post code' etc. Not every field is populated with data, there are many null values (not every address has an 'organisation' name for example).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've created a new text field called 'Full_Addr' which will merge all the address fields into one. So far I used this VB script in field calculator:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Full_Addr=&lt;/P&gt;&lt;P&gt;[OrganisationName]&amp;amp; ", " &amp;amp; [BuildingName]&amp;amp; ", " &amp;amp; [BuildingNumber]&amp;amp; ", " &amp;amp; [Thoroughfare]&amp;amp; ", " &amp;amp; [PostTown]&amp;amp; ", " &amp;amp; [Postcode]&lt;/P&gt;&lt;P&gt;However this results in entries like:&lt;/P&gt;&lt;P&gt;, , 1, Example Street, Example Town, AB1 2CD&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Example Organisation, , , Example Street, Example Town, AB1 2CD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a smarter, more efficient way of creating a merged address field without the double, triple or quadruple ", "?&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2017 17:33:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206158#M15856</guid>
      <dc:creator>TheodoreF</dc:creator>
      <dc:date>2017-12-11T17:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Address Fields into one...</title>
      <link>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206159#M15857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, you can emulate the following, by simply collecting the field values into a list and assuming you are working in a geodatabase, None should be the equivalent of &amp;lt;Null&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Worth a look... the key is in the ", ".join bit and the test for null&lt;/P&gt;&lt;P&gt;BTW this is python... don't know if vb* has a equivalent, but switch to the python parser to use this idea&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;a &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'a'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'b'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'c'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'d'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;", "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;i &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; a &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;'a, b, c, d'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:11:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206159#M15857</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T10:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Address Fields into one...</title>
      <link>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206160#M15858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have not tried it but this might do what you need: System Toolboxes &amp;gt; Geocoding Tools &amp;gt; Standardize Addresses&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2017 18:30:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206160#M15858</guid>
      <dc:creator>BillFox</dc:creator>
      <dc:date>2017-12-11T18:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Address Fields into one...</title>
      <link>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206161#M15859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan's suggestion is valid, to expand on it you could use Calculate Field to do the concatenation, but another simple way is with the Field Map in Feature Class to Feature Class, add a new output field with Join merge rule and space or comma join value then add input fields to the new output field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2017 22:13:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206161#M15859</guid>
      <dc:creator>BruceHarold</dc:creator>
      <dc:date>2017-12-11T22:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Address Fields into one...</title>
      <link>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206162#M15860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the field calculator VB script does not have any more efficient way.&amp;nbsp; In VB language ... like .net&amp;nbsp; -- yes there are other ways.&amp;nbsp; Testing for Null's in VB&amp;nbsp; is by using the "is NULL" test.&amp;nbsp; However in my experience with addresses I use an old fashion test and test for one blank space&amp;nbsp; &amp;nbsp;by doing something like this ...&amp;nbsp; if a &amp;amp; "" = "" then&amp;nbsp; do something.&amp;nbsp; In vb if a null is concatenated with a space then the value will be a space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am an old fashion VB'r but I would highly recommend doing this in Python there is less and less support for VB.&amp;nbsp; Already ESRI has downgraded from VBA to VBScript in ArcMap.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Dec 2017 15:28:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206162#M15860</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2017-12-12T15:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Address Fields into one...</title>
      <link>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206163#M15861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for all the help. I'll give your suggestions a whirl today!&lt;/P&gt;&lt;P&gt;Theo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2017 09:34:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206163#M15861</guid>
      <dc:creator>TheodoreF</dc:creator>
      <dc:date>2017-12-13T09:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Address Fields into one...</title>
      <link>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206164#M15862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This may sound silly (I'm still learning), but are 'a' , 'b , 'c' and 'd'&amp;nbsp; substitutes for my field names?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since I posted my question, I'm actually ommitting OrganisationName and PostTown from my final output, so now with less variables it might be more simple.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2017 09:50:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206164#M15862</guid>
      <dc:creator>TheodoreF</dc:creator>
      <dc:date>2017-12-13T09:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Address Fields into one...</title>
      <link>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206165#M15863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the a, b, c, d were just placeholders for the field names (with appropriate pre- and post markers ie ! for python). &amp;nbsp;&lt;/P&gt;&lt;P&gt;To ensure that your environment gets the correct fieldname surround, it is best to set the parser used first, then physically select the fieldname from the available fields rather than type them in full.&amp;nbsp; If there is a chance that there are going to be numeric values involved, you can cast them to string.&amp;nbsp; For example, for a simple 2 field concatenation with a check I used this example to do the change to string since X_min was numeric... I didn't want anything to be done to the record if 'i' was a None value in either field.&amp;nbsp; Since the result was going to a string field, I just made sure that the values were changed to string.&amp;nbsp; I could have written a function for it... but I made the list ( [ !file_part!, !X_min! ] ) within the test rather than pre-constructing the list...&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just do what is faster especially if you don't need to reuse a function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;", ".join([str(i) for i in [!file_part!, !X_min!] if i is not None])&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2017 10:06:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206165#M15863</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-12-13T10:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Address Fields into one...</title>
      <link>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206166#M15864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;python parser... in Pro... join the contents in 2 fields unless one of them contains None.&amp;nbsp; Since we might be combining test and string, just convert to string first.&amp;nbsp; Lastly, join the 2 with a comma-space separator&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;", "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;!file_part!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;!X_min!&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Dec 2017 10:09:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merge-address-fields-into-one/m-p/206166#M15864</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-12-13T10:09:50Z</dc:date>
    </item>
  </channel>
</rss>

